[Numpy-discussion] Shouldn't all in-place operations simply return self?
Fri Jan 18 18:08:22 CST 2013
On Thu, Jan 17, 2013 at 11:13 PM, Thouis (Ray) Jones <email@example.com>wrote:
> On Thu, Jan 17, 2013 at 10:27 AM, Charles R Harris
> <firstname.lastname@example.org> wrote:
> > On Wed, Jan 16, 2013 at 5:11 PM, eat <email@example.com> wrote:
> >> Hi,
> >> In a recent thread
> >> http://article.gmane.org/gmane.comp.python.numeric.general/52772 it was
> >> proposed that .fill(.) should return self as an alternative for a
> >> two-liner.
> >> I'm raising now the question: what if all in-place operations indeed
> >> return self? How bad this would be? A 'strong' counter argument may be
> >> at http://mail.python.org/pipermail/python-dev/2003-October/038855.html
> >> But anyway, at least for me. it would be much more straightforward to
> >> implement simple mini dsl's
> >> (http://en.wikipedia.org/wiki/Domain-specific_language) a much more
> >> straightforward manner.
> >> What do you think?
> > I've read Guido about why he didn't like inplace operations returning
> > and found him convincing for a while. And then I listened to other folks
> > express a preference for the freight train style and found them
> > also. I think it comes down to a preference for one style over another
> and I
> > go back and forth myself. If I had to vote, I'd go for returning self,
> > I'm not sure it's worth breaking python conventions to do so.
> > Chuck
> I'm -1 on breaking with Python convention without very good reasons.
Three times -1: on breaking Python conventions, on changing any existing
numpy functions/methods for something like this, and on having similarly
named functions like shuffle/shuffled that basically do the same thing.
+1 on using out= more, and on some general guideline on
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion