The argument is not silly, it totally makes sense, and your point even proves that.
A lot of libraries use module-level globals and if you use from imports (especially fromX import *) you get exactly that issue.
Yes, many more modern APIs use an object-oriented approach, which is left-to-right, and that’s exactly what OOP is argueing for. If you notice, he didn’t end the post with “Make good languages” but with “Make good APIs”. He highlights a common problem using well-known examples and generalizes it to all APIs.
The auther knows full well that this blog post will not cause Python to drop the List comprehension syntax or built-in functions. What he’s trying to do is to get people to not use non-LTR approaces when designing APIs. All the points he made are correct, and many are even more pressing in other languages.
For example, for a hobby project of mine I have to use C/C++ (microcontrollers). And this problem is huge in C libraries. Every function is just dumped into the global name space and there’s no way to easily find the right function. Often I have to go to google and search for an external documentation or open up the header files of a project to find a function that does what I want, instead of being able to just follow the IDE autocomplete on an object.
And sure, if I know every library and framework I use inside out and memorized all functions, methods, objects, variables and fields, then it’s easy, but unless you work 30 years in a bank where you maintain the same old cobol script for decades, that’s not going to happen.
That’s malpractice in most cases, and thankfully, becoming more rare to find in the wild. Any decent linter will shout at you for using star imports.
What he’s trying to do is to get people to not use non-LTR approaces when designing APIs.
Then he should have picked examples of APIs that break this, not use the built-in functions. Because as it reads now, it seems he is just against established conventions for purism.
this problem is huge in C libraries
yeah, one of my favorite things about python is that everything not in the language itself is either defined in the file, or explicitly imported. Unless, like mentioned, you have anti-patterns like star imports and scripts messing with globals().
He’s using simple examples that everyone knows and understands instantly. It’s like using a minimal test case to report a bug. In most cases a minimal test case is also nonsensical on its own, but it’s used to show an issue that occurred in a more complex context without overloading the reader with useless garbage info that doesn’t contribute to the point at hand.
The argument is not silly, it totally makes sense, and your point even proves that.
A lot of libraries use module-level globals and if you use from imports (especially
from X import *
) you get exactly that issue.Yes, many more modern APIs use an object-oriented approach, which is left-to-right, and that’s exactly what OOP is argueing for. If you notice, he didn’t end the post with “Make good languages” but with “Make good APIs”. He highlights a common problem using well-known examples and generalizes it to all APIs.
The auther knows full well that this blog post will not cause Python to drop the List comprehension syntax or built-in functions. What he’s trying to do is to get people to not use non-LTR approaces when designing APIs. All the points he made are correct, and many are even more pressing in other languages.
For example, for a hobby project of mine I have to use C/C++ (microcontrollers). And this problem is huge in C libraries. Every function is just dumped into the global name space and there’s no way to easily find the right function. Often I have to go to google and search for an external documentation or open up the header files of a project to find a function that does what I want, instead of being able to just follow the IDE autocomplete on an object.
And sure, if I know every library and framework I use inside out and memorized all functions, methods, objects, variables and fields, then it’s easy, but unless you work 30 years in a bank where you maintain the same old cobol script for decades, that’s not going to happen.
That’s malpractice in most cases, and thankfully, becoming more rare to find in the wild. Any decent linter will shout at you for using star imports.
Then he should have picked examples of APIs that break this, not use the built-in functions. Because as it reads now, it seems he is just against established conventions for purism.
yeah, one of my favorite things about python is that everything not in the language itself is either defined in the file, or explicitly imported. Unless, like mentioned, you have anti-patterns like star imports and scripts messing with globals().
He’s using simple examples that everyone knows and understands instantly. It’s like using a minimal test case to report a bug. In most cases a minimal test case is also nonsensical on its own, but it’s used to show an issue that occurred in a more complex context without overloading the reader with useless garbage info that doesn’t contribute to the point at hand.