Re:NumPy Illustrated: The Visual Guide to NumPy
by adamjb on Tuesday December 29, 2020 @03:35AM
(#25567888)
Here's the rejected PEP for operator overloading.
https://www.python.org/dev/peps/pep-0335/
and deferred PEP for rich comparison chaining specifically
https://www.python.org/dev/peps/pep-0535/
The central issue is that `3<=a<=5` expands to `3<=a and a<=5`, and `and` coerces the variables to booleans in order to work.
Re:NumPy Illustrated: The Visual Guide to NumPy
by proverbialbunny on Tuesday December 29, 2020 @03:50AM
(#25567964)
>and deferred PEP for rich comparison chaining specifically
>https://www.python.org/dev/peps/pep-0535/
Oh nice! Thank you for sharing. I'm sure the functionality will eventually come.
Re:NumPy Illustrated: The Visual Guide to NumPy
by roudaki on Tuesday December 29, 2020 @07:13AM
(#25569012)
I have been doing math in python for a year and this explains so much. I feel so stupid now. Thank you for this from self thought dev.
Re:NumPy Illustrated: The Visual Guide to NumPy
by axi1 on Tuesday December 29, 2020 @02:48AM
(#25567679)
Apparently there're problems with overloading this. In pandas it is between(left,right), so they also didn't find a way to get it done properly.
Anyone have any idea why? I imagine if they could support it they would support it. I wonder if Python doesn't allow this kind of operator overloading?