Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
type annotations
#3
I don't bother with them for prototyping, but I'm a fan of them for anything non-trivial, especially if someone else might read that code someday (e.g. me in a few months). I was code reviewing some Python the other day and I spent far too much time trying to figure out the types, partly because they had a variable which could be a string or a dictionary (erroneously). If they'd have spent a negligible amount of time adding type hints to their code, I would have spotted the bug much, much faster, assuming they didn't find it themselves. I have in my queue of things to talk to my manager about to require type hinting in Python written at my company. We're primarily a Scala shop, and Scala has a very robust static typing system, so I expect it'll be well-received.

(Imagine how much easier it would be reading huge blocks of code on the forum if they're type-hinted and you know mypy passes. I'm probably still too lazy to read code long enough for it to be worth it, but hey.)
Reply


Messages In This Thread
type annotations - by perfringo - Sep-26-2019, 09:58 AM
RE: type annotations - by DeaD_EyE - Sep-26-2019, 11:37 AM
RE: type annotations - by micseydel - Sep-26-2019, 09:26 PM
RE: type annotations - by snippsat - Oct-05-2019, 03:44 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020