3 ms·
Having a bit of experience with Python, I’d say it doesn’t exemplify > Special cases aren't special enough to break the rules. > There should be one-- and pre
by saagarjha 7y ago
Having a bit of experience with Python, I’d say it doesn’t exemplify
> Special cases aren't special enough to break the rules.
> There should be one-- and preferably only one --obvious way to do it.
Python is complicated enough that the language and standard library often have multiple ways of doing the same thing. And there are still a number of “special cases” in the language, or at least non-intuitive results. Certain things are mutable (probably for performance?) when they shouldn’t be, some things behave in odd ways, and certain distinctions are made blurry but then it comes back to bite you when you do something non-trivial and the differences become apparent.
- _never_k 7y agoThis is the way I feel too. Python is both redundant and inconsistent at a basic level. The APIs for `map`, `filter` and `reduce`, the inversion between `split` and `join`, `sort` vs `sorted` -- it's all very weird. And these aren't advanced features. When I hear people describe Python as simple and elegant, it feels like they're using a different language than the one I know.
- kstrauser 7y agoNote: in practice, almost no one uses map, filter, and reduce. Those are almost 100% replaced by list and generator comprehensions in code written in the last decade or so. The difference between split and join is kind of weird, I'll grant. I'm not sure why it was done that way. `sort` is in place. You're telling an object to order itself: "hey you! Sort yourself!" `sorted` returns a copy of an object, but... sorted. You're asking for the sorted version of that thing.