|
|
|
|
|
by dajtxx
543 days ago
|
|
Python seems to have started with 'why do those other languages have all this trash' and then spent the time since then learning why and coming up with worse versions. I use python a lot these days, and like it, but it's pretty funny seeing stuff like the above and type hints. I hate not knowing what types a function takes and returns. |
|
This seems true to me too. Examples:
* if __name__ == "__main__": main()
* Private members being marked by convention with leading underscore (e.g. def _foo()) instead of being a language feature
* @staticmethod as a decorator instead of being a language feature
* Duck typing vs. abstract base classes
* Static type hints got retrofitted to the language gradually, one feature at a time
* Reference-counted garbage collection seems to be more deterministic than tracing garbage collection and ensures that unreachable resources have their finalizers run as soon as possible... except it's not true
* Having a GIL instead of being truly multi-threaded from day one
* Various OOP concepts that are much better explained in Java than Python: __eq__(), __hash__(), monitor wait() and notify(), object finalizers, thread safety, weak references
* Distinction between str and bytes. This is the biggest change from Python 2 to 3 and caused a lot of incompatibilities. Java separated String and byte[] from the start (though the use of UTF-16 is unfortunate).