4 ms·
I never ported something from 2 to 3, but whenever I read about it I wonder, wouldn't the new typing [0] module be enough to cope with this? It let's you annota
by Rotareti 9y ago
I never ported something from 2 to 3, but whenever I read about it I wonder, wouldn't the new typing [0] module be enough to cope with this? It let's you annotate types like 'str', 'bytes', 'bytearray', etc. My IDE shows me right away, whenever I have the types wrong and with all the annotations visible I find it pretty easy to reason about types.
[0] https://docs.python.org/3/library/typing.html https://docs.python.org/3/library/typing.html
- seanwilson 9y agoSounds like it would help but it sounds like the same 2 to 3 issue that everyone has to start migrating to it. > My IDE shows me right away, whenever I have the types wrong and with all the annotations visible I find it pretty easy to reason about types. Do you find it makes you more productive? Honestly not trying to troll but my feeling is people that defend strong dynamic typing just haven't used strong statically type languages enough because the benefits are painfully obvious to me when you switch between them.
- Rotareti 9y ago> it sounds like the same 2 to 3 issue that everyone has to start migrating to it. If you don't like to have it in your code base, then you could use it for the migration phase and remove it afterwards, or just leave it in the parts of the project, where it was helpful. It's totally optional, meaning, you can use it just on some parts of your code without affecting the rest. > Do you find it makes you more productive? It makes me a lot more productive. Especially when I touch code that I haven't seen in a while. I use it everywhere. Actually my IDE highlights items that I forgot to annotate. > Honestly not trying to troll but my feeling is people that defend strong dynamic typing just haven't used strong statically type languages enough because the benefits are painfully obvious to me when you switch between them. I'm not defending strong dynamic typing. I just think that the typing module makes Python a better language. I use the typing module for the same reason I switched from JavaScript to TypeScript and the experience I have working in both, Python+typing and TypeScript, is very similar, even though TypeScript is strong statically typed.
- seanwilson 9y ago> I'm not defending strong dynamic typing. I just think that the typing module makes Python a better language. I use the typing module for the same reason I switched from JavaScript to TypeScript and the experience I have working in both, Python+typing and TypeScript, is very similar, even though TypeScript is strong statically typed. I think you've misread me, I had the exact same experience with both languages and agree with you.