Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So that people who want to use it, can?

You don't have to use it if you don't want to.



Python’s philosophy is supposed to be “one obvious way to do it”, not “you decide which way to do it, it’s optional”.


There is one obvious way to add type annotations. The annotations themselves are optional. That's just gradual typing[0], and it doesn't "break" the zen of python any more than having the choice of using a class over free functions in your program.

The meme going around that Python is adding so many features that it's becoming something "not python" is super weird to me, and it appears as though it's propagated since the walrus operator discussion and hasn't really gone away.

All popular languages add features and adapt as new tools, methodologies, and learnings pop up from other communities. This is a good thing (subjective, I guess), and in general I find Python to be somewhat restrained.

[0] https://en.wikipedia.org/wiki/Gradual_typing


> Python is adding so many features that it's becoming something "not python"

Here's an example I came across recently. It's from the official documentation for the `heapq` module, so I assume it's now considered the idiomatic way to write a wrapper for each item in a priority queue:

    @dataclass(order=True)
    class PrioritizedItem:
        priority: int
        item: Any=field(compare=False)
That's completely different to the way such a class would have been written even in Python 3.4. It would have been a simple class with an explicit `__init__` and `__lt__`. Instead, the above dataclass sits on top of a mountain of complexity and everything about it is implicit.

It's in violation of both "Simple is better than complex" and "Explicit is better than implicit".


That's not been the case for a very long time now.


Agreed (type hints are just one example), but I wish it were.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: