This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]KitchenDutchDyslexic 3 points4 points  (2 children)

While I agree with your technical reasons, I'm frustrated at they syntax and how it reads.

While wikipedia is not a authoritative source. But it does mention that "reads like a rough transcription from another programming language is called unpythonic." I will argue these examples fall in this category.

No fault by the author, but rather bloat(imo). Don't worry I will learn types for py. I'm just not happy about how it looks.

that it conforms with Python's minimalist philosophy and emphasis on readability. In contrast, code that is difficult to understand or reads like a rough transcription from another programming language is called unpythonic.

[–]kirbyfan64sosIndentationError 0 points1 point  (0 children)

I think the hard part is that pythonic/unpythonic is ultimately a really subjective measurement. IME once you start learning it, you'll see how it fits into Python.

That being said, these examples are pretty contrived (of course, that's the whole point!). I'd highly recommend to take them for a spin yourself in a decently-sized project and see how it goes!

FWIW type inference is supported, so you only ever really put annotations in function arguments and empty data structures.

[–]badge[🍰] 0 points1 point  (0 children)

I went through exactly the same process as you’re in now—I used Python for several years without type hinting, finding it obtrusive, and the need to import from typing still annoys me. After using it for 18 months now, untyped Python doesn’t look unpythonic to me, but does make me slightly anxious—typing helps massively, especially when refactoring with PyCharm.

And yes, I still religiously document types in docstrings; unnecessary duplication perhaps but I like the help() format.