I don’t enjoy coding Python. I think its:
- Syntax is awkward. The strife between tabs and spaces is real, and sometimes annoying too, if you’re making quick edits without using a sophisticated code editor.
- Lambda functions are limited to a single line. Let’s be real—naming things is hard, and I wouldn’t want to name every multi-line anonymous function some awkward name.
- API is inconsistent.
len(v)is a function (procedural), butv.append()is a method (object-oriented). And, more interestingly,len(v)callsv.__len__()under the hood.- One argument could be raised that it’s procedural to distinguish its polymorphic nature, but that argument is inevitably weak, because duck typing—a method often pursued—could be used (e.g.
v.length) to determine its length. - Another argument could be raised that it enforces a certain protocol of determining length, but that argument is also weak, because the protocol could just be defined differently.
- Features like namedtuples are somewhat cumbersome and obscure, and few people effectively use dataclasses. Most still use bare-tuples and manual classes.
- Features like enums (in the
enummodule) have been overcomplicated, as a result, most people and the standard library itself, just resort to comparing strings or bitflags. loggingmodule notoriously uses camelCase, and printf-style functions which is to mirror Java apparently.
- No method chaining for iterators like Java Streams API or C# LinQ, only parenthetic chaining; it's very ugly, and most people steer clear from that.
- So many ways to do one-thing, and not being obvious about it. printf-style formatting,
format(),str.format(),string.Template, f-strings, t-strings—are all the ways string interpolation is done. And, there’s the whole format-specification mini language, whose features people are barely even aware of, because it’s buried under documentation that sounds less like a formal manual, and more like a braindump of a terminally sleep deprived programmer. - Slow.
- It’s default and most popular implementation—CPython—doesn’t include a JIT, and PyPy isn’t as popular or on-par the development cadence.
- The library designers actively push the “ease of use manifesto”, sacrificing performance by default.
- Asynchronous programming is certainly hard to get started with compared to JavaScript; it’s semantics are certainly not trivial. The presence of three different types
Task,Future, and coroutines is certainly more complicated than JavaScript’s simplePromise(pun intended). And, every synchronous API requires an asynchronous flavour—function coloring. - Highly inconsistent in providing OS related APIs (in the
osortimemodule), and a very weird and I daresay, incomprehensible, IO model (in theos) with all its nonsensical abstract base classes.
Aside from this, I believe much of the ecosystem is steered towards AI/ML, statistics and scientific computing. And, as a result, web-related features that all modern people expect, e.g. HTTP/2 or HTTP/3, are missing from the major standard libraries.