Re: More appropriate behavior for the NotImplemented object
On Mon, 16 Mar 2020 at 04:51, Kyle Stanley <aeros167@gmail.com> wrote:
PEP 8 itself is very far from a definitive authority. Its scope is specifically intended to cover CPython stdlib development, not all uses of Python.
Yes, I know. But it's a common convention, and Python relies often on conventions. For example, the underscore at the start of a variable. I mean, this breaks duck typing. I expect the object to quack, and instead it roars. And this is because bool(my_numpy_array == 42) should return True if the standard is followed, even if _no_ element of `my_numpy_array` is equal to 42. Indeed it looks strange... but this is because they changed the __eq__() operator too! They could simply add another method or use another operator, as they did for matrix multiplication. This way it was clear that they are _not_ returning a boolean, but an ndarray. I can't bet on it, but I will surprised if someone propose a similar behavior for some new data object in CPython and the PEP will be not rejected. The problem is that NumPy is so much popular that changing this "feature" would be a disaster. But IMHO this is no more Python. They created another language and a disjointed ecosystem. I knew many scientists that knows only NumPy and SciPy. They have little knowledge of the rest of Python. Furthermore they usually uses Anaconda, with the conda package manager. I don't know them very well, since I do not use it, but conda seems to use a very strange method for managing the packages. It's all o, until you install packages from the conda repo, but, if you want to install some package from Pypi that is not in conda repo, it could be a mess... Finally, Anaconda it's commonly used with Spyder, that is a good IDE IMHO. The problem is it integrates Jupyter in the text editor by default, so their "code" is a mix of numpy+scipy code with IPython magic words.
This has turned into a rant about numpy and the scipy ecosystem -- not relevant at all to python-ideas. Please stop. -CHB On Mon, Mar 16, 2020 at 9:51 AM Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
On Mon, 16 Mar 2020 at 04:51, Kyle Stanley <aeros167@gmail.com> wrote:
PEP 8 itself is very far from a definitive authority. Its scope is specifically intended to cover CPython stdlib development, not all uses of Python.
Yes, I know. But it's a common convention, and Python relies often on conventions. For example, the underscore at the start of a variable.
I mean, this breaks duck typing. I expect the object to quack, and instead it roars. And this is because
bool(my_numpy_array == 42)
should return True if the standard is followed, even if _no_ element of `my_numpy_array` is equal to 42. Indeed it looks strange... but this is because they changed the __eq__() operator too! They could simply add another method or use another operator, as they did for matrix multiplication. This way it was clear that they are _not_ returning a boolean, but an ndarray.
I can't bet on it, but I will surprised if someone propose a similar behavior for some new data object in CPython and the PEP will be not rejected.
The problem is that NumPy is so much popular that changing this "feature" would be a disaster. But IMHO this is no more Python. They created another language and a disjointed ecosystem. I knew many scientists that knows only NumPy and SciPy. They have little knowledge of the rest of Python.
Furthermore they usually uses Anaconda, with the conda package manager. I don't know them very well, since I do not use it, but conda seems to use a very strange method for managing the packages. It's all o, until you install packages from the conda repo, but, if you want to install some package from Pypi that is not in conda repo, it could be a mess...
Finally, Anaconda it's commonly used with Spyder, that is a good IDE IMHO. The problem is it integrates Jupyter in the text editor by default, so their "code" is a mix of numpy+scipy code with IPython magic words.
-- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
participants (2)
-
Christopher Barker
-
Marco Sulla