4 ms·
"Python is easy to use" is a relative statement about its priorities. Compare to other languages that have different priorities. Python is easier and slower tha
by neolog 6y ago
"Python is easy to use" is a relative statement about its priorities. Compare to other languages that have different priorities. Python is easier and slower than C++, for example.
There are many design errors in Python, of course. But most "wtfpython" things don't actually affect people using the language -- they're engineered to identify funny compiler optimizations and floating-point peculiarities. The real problems of a language aren't usually the kind of thing demonstrated in a couple-line snippet. Though there are exceptions.
- jolux 6y ago>Python is easier and slower than C++, for example. Most languages are easier than C++, and many of them are faster than Python.
- neolog 6y agoThere are many dimensions that different languages prioritize. As you increase the number of dimensions you consider important, the number of languages that are better than $language on all of your important dimensions tends to decrease.
- jolux 6y agoSure. I have a lot of problems with Python’s design and find it grating, and I don’t think its biggest problems are about tradeoffs, they’re just mistakes.
- Izkata 6y ago> But most "wtfpython" things don't actually affect people using the language Plenty do though. I've passed that page onto co-workers a lot, back when the list was smaller, and almost every time they've found something on the page that explains a bit of weirdness with Python that they'd just dismissed as buggy behavior and avoided touching. The ones I remember them mentioning: https://github.com/satwikkansal/wtfpython#-mutating-the-immutable https://github.com/satwikkansal/wtfpython#-mutating-the-immu... https://github.com/satwikkansal/wtfpython#-beware-of-default-mutable-arguments https://github.com/satwikkansal/wtfpython#-beware-of-default... And I multiple times I've had to explain the difference between references / shallow copy / deep copy to bootcampers, which falls under https://github.com/satwikkansal/wtfpython#-a-tic-tac-toe-where-x-wins-in-the-first-attempt https://github.com/satwikkansal/wtfpython#-a-tic-tac-toe-whe...
- andi999 6y agoShallow and deep copy is a surprising concept, but I think it is the core feature that actually allows python to handle large datasets.
- neolog 6y agoIMO those two gotchas (mutable default and late-binding closures) are actually the main ones. That's why they're mentioned explicitly here https://docs.python-guide.org/writing/gotchas/ https://docs.python-guide.org/writing/gotchas/ Shallow/deep copies is an unavoidable part of having mutable data. The main alternative way to handle mutation is a fancy type system like Rust's, which is not an acceptable tradeoff for new programmers.