I killed my libraries support for python 2 last Friday. It feels good to get rid of six, future, scans it, and pathlib2 and really start doing type annotations properly.
People are already trying to get me to change my mind. But my company uses Anaconda...use a virtual environment; Anaconda lets you have multiple versions of python. It’s coming like a train and all my dependencies have moved on. Time for me to as well.
In total agreement with you except for the type annotations. I see those as an abomination. Python is so beautiful as a syntax without those horrible glyphs.
While these annotations are available at runtime through the usual annotations attribute, no type checking happens at runtime . Instead, the proposal assumes the existence of a separate off-line type checker which users can run over their source code voluntarily
See? An abomination. I'll never introduce those in my personal projects.
I fail to see what you "see" in this quote. I personally don't use type annotation in my current python project, but it's only due to the nature of what I'm doing. It's probably your case too and that's why you fail to see why it can be useful to have static type checking. But in many cases, adding types is fast and simple, it serves as a documentation, helps autocompletion and saves you a lot of debugging time (because you will obviously have less typing errors). The best part is: it's optional, so you can very well add types to sensitives part of your code (low level, widely used code) and leave high level functions signatures untyped and documented them using docstrings.
Have a look at the javascript (ECMAScript) community and you'll see that many people are using flow or typescript annotations, even tho it's not as clean as mypy+python because it requires transpilation (in order to remove annotations and get the javascript code back to standard).
277
u/billsil May 30 '19
I killed my libraries support for python 2 last Friday. It feels good to get rid of six, future, scans it, and pathlib2 and really start doing type annotations properly.
People are already trying to get me to change my mind. But my company uses Anaconda...use a virtual environment; Anaconda lets you have multiple versions of python. It’s coming like a train and all my dependencies have moved on. Time for me to as well.