Hey all,
I was feeling grotty and unproductive yesterday, so I decided to procrastinate by writing a PEP, which I figure we might as well throw at the wall and see if it sticks. At least, once we do have consensus on what it says -- I think we probably pretty much do, but let me know. Any other comments, suggestions, pointings out of places where I out a word, and arguments about how I've made some terrible mistakes, are also very welcome; I guess we probably only get one more chance at this. Cheers, -n -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user return-of-revenge-of-matmult-pep.rst (35K) Download Attachment |
It has to easily explain why subclassing is unsatisfactory. Otherwise it
will be thrown out with the argument that we can just subclass. Sturla Nathaniel Smith <[hidden email]> wrote: > Hey all, > > I was feeling grotty and unproductive yesterday, so I decided to > procrastinate by writing a PEP, which I figure we might as well throw at > the wall and see if it sticks. At least, once we do have consensus on > what it says -- I think we probably pretty much do, but let me know. Any > other comments, suggestions, pointings out of places where I out a word, > and arguments about how I've made some terrible mistakes, are also very > welcome; I guess we probably only get one more chance at this. > > Cheers, > -n > > -- > Nathaniel J. Smith > Postdoctoral researcher - Informatics - University of Edinburgh > <a href="http://vorpus.org">http://vorpus.org</a> > > _______________________________________________ SciPy-User mailing list > [hidden email] <a > href="http://mail.scipy.org/mailman/listinfo/scipy-user">http://mail.scipy.org/mailman/listinfo/scipy-user</a> _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
On 22 Feb 2014 05:21, "Sturla Molden" <[hidden email]> wrote: Do you mean the first "Alternative" (second half of "Rationale"), or something else? -n > _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
On 22/02/14 12:36, Nathaniel Smith wrote:
> On 22 Feb 2014 05:21, "Sturla Molden" <[hidden email] > <mailto:[hidden email]>> wrote: > > > > It has to easily explain why subclassing is unsatisfactory. Otherwise it > > will be thrown out with the argument that we can just subclass. > > Do you mean the first "Alternative" (second half of "Rationale"), or > something else? > > -n I dont't care as long as the reader will understand that subclassing is not a viable option. Just make sure it does not drown in TL;DR text. Say it early and preferably repeat it several times, so it does not get missed. This is a literary strategy I've learned to use from writing grant applications: Most of the prosaic text is never read, so make sure the major message stand out as conspicuously as possible. Subclassing is likely to be the major counter-argument, so make sure you shoot it down thoroughly. Sturla _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
On 22 Feb 2014 14:26, "Sturla Molden" <[hidden email]> wrote: My question is what counterargument are you referring to when you say "subclassing" :-). Is it the "you should just have both np.matrix and np.ndarray" argument? -n _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
In reply to this post by Nathaniel Smith
You know, better idea: let's move discussion to a PR:
https://github.com/numpy/numpy/pull/4351 -n On Sat, Feb 22, 2014 at 12:04 AM, Nathaniel Smith <[hidden email]> wrote: > Hey all, > > I was feeling grotty and unproductive yesterday, so I decided to > procrastinate by writing a PEP, which I figure we might as well throw > at the wall and see if it sticks. At least, once we do have consensus > on what it says -- I think we probably pretty much do, but let me > know. Any other comments, suggestions, pointings out of places where I > out a word, and arguments about how I've made some terrible mistakes, > are also very welcome; I guess we probably only get one more chance at > this. > > Cheers, > -n > > -- > Nathaniel J. Smith > Postdoctoral researcher - Informatics - University of Edinburgh > http://vorpus.org -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
In reply to this post by Nathaniel Smith
I like this idea and draft PEP a lot. Having this feature would ease my programming and greatly improve the readability of my SciPy programs. http://www.haskell.org/haskellwiki/Function_composition Of course the dot's unpalatable here as it's an accessor in Python. The use of @ for composition might go some way to addressing the concern about adding an operator with no stdlib uses: I presume it does contain a few functional compositions. _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
In reply to this post by Nathaniel Smith
Nathaniel Smith <[hidden email]> wrote:
> Subclassing is likely to be the major counter-argument, so make sure you > shoot it down thoroughly. > > My question is what counterargument are you referring to when you say > "subclassing" :-). Is it the "you should just have both np.matrix and np.ndarray" argument? > Yes, exactly that, but perhaps from a more a more principal point of view: That subclassing and overloading the operator in a subclass is the more "pythonic" way to change the behavior of an operator. Whereas adding more syntactic bloat is unpythonic. So we have to explain why subclassing and operator overloading is insufficient. Sturla _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Hi,
On Sat, Feb 22, 2014 at 6:57 PM, Sturla Molden <[hidden email]> wrote: > Nathaniel Smith <[hidden email]> wrote: > >> Subclassing is likely to be the major counter-argument, so make sure you >> shoot it down thoroughly. >> >> My question is what counterargument are you referring to when you say >> "subclassing" :-). Is it the "you should just have both np.matrix and np.ndarray" argument? >> > > Yes, exactly that, but perhaps from a more a more principal point of view: > That subclassing and overloading the operator in a subclass is the more > "pythonic" way to change the behavior of an operator. Whereas adding more > syntactic bloat is unpythonic. So we have to explain why subclassing and > operator overloading is insufficient. Yes, we do need to explain why we need two '*' operators, one for element-wise multiplication and one for matrix multiplication. Sub-classing can't do that for us - as we've know well - we just one replace one mult by the other. Cheers, Matthew _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Free forum by Nabble | Edit this page |