[Numpy-discussion] Shouldn't all in-place operations simply return self?
Charles R Harris
Thu Jan 17 09:27:25 CST 2013
On Wed, Jan 16, 2013 at 5:11 PM, eat <firstname.lastname@example.org> wrote:
> 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 trivial
> I'm raising now the question: what if all in-place operations indeed could
> return self? How bad this would be? A 'strong' counter argument may be
> found at
> 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 self
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 convincing
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,
but I'm not sure it's worth breaking python conventions to do so.
> P.S. FWIW, if this idea really gains momentum obviously I'm volunteering
> to create a PR of it.
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion