2 ms·
Sure Python has many problems, but these aren't a great selection. Yes. I have my disagreements with Python, but those are not it. The article author is mostly
by Animats 7y ago
Sure Python has many problems, but these aren't a great selection.
Yes. I have my disagreements with Python, but those are not it.
The article author is mostly complaining about ways Python differs from Javascript.
- Agree that the mechanism for talking about parent classes wasn't very good. Multiple inheritance usually adds complication without adding much necessary functionality. That's not just a Python problem. It's a leftover from viewing objects through an "A is-a B" lens, one of the dead ends of early AI.
- Python has too much gratuitous dynamism. Any thread can find and mess with any code and data in another thread. The implementation has to support that, which knocks out many valuable optimizations. The language model, and the original implementation, use "everything is a dict", which implies "slow".
- One consequence of the above is Python's terrible one thread at a time thread system, with the "global interpreter lock". The "multiprocessing" hack to get around that is ugly and uses too much memory, since each subprocess has its very own Python system instance. To some extent, the "async" add on is yet another hack to get around the limits of threading.
- Another consequence is a tendency to call C code where Python performance is terrible. The C code has to carefully obey the rules of the Python system. Mostly it does.
- Optional typing is a marginal idea, but unchecked marginal typing is just weird. Language design seems to be converging on implicit static typing - result variables are automatically typed whenever possible. Go, Rust, and now C++ (with "auto") took that route.
- And, of course, the botched Python 2 to 3 transition set Python back for a decade.
On the other hand, Python exceptions work out well. A reasonably sane exception hierarchy helps. Although the one for 2.x was better than the one for 3.x; the 2.x one made a clear distinction between external problems ("Environment errors") and internal problems.
The "with" clause system plays well with exceptions, and nested exception failures unwind correctly.
It's far better than Go's "defer". C++ and Rust try to handle this sort of thing with RAII, which never handles trouble in a destructor well.
- j88439h84 7y agoRegarding performance, I'm hoping alternate interpreters like pypy start thriving. Theres no reason python needs to be as slow as CPython.