Re: [Python-Dev] Returning None from methods that mutate object state

2014-05-20 Thread Guido van Rossum
On Tuesday, May 20, 2014, Greg Ewing wrote: > Chris Barker wrote: > >> Personally, I often miss the ability to chain operations on mutable >> objects, but I can only imagine that that design decision was made for good >> reason. However, as I teach Python, I find I have nothing to say other than

Re: [Python-Dev] Returning None from methods that mutate object state

2014-05-20 Thread Terry Reedy
On 5/20/2014 12:30 PM, Chris Barker wrote: [].sort() is None > True "ABC".lower() is None > False Is there a reference anywhere as to *why* the convention in Python is to do it that way? In short, reducing bugs induced by mutation of aliased objects. Functional

Re: [Python-Dev] Returning None from methods that mutate object state

2014-05-20 Thread R. David Murray
On Tue, 20 May 2014 09:30:47 -0700, Chris Barker wrote: > > > > [].sort() is None > > > True > > "ABC".lower() is None > > > False > > > > > > That's a deliberate design choice, and one that has been explained a > > > few times on the list when folks ask why "[].sort().reverse()" doesn't

Re: [Python-Dev] Returning None from methods that mutate object state

2014-05-20 Thread Greg Ewing
Chris Barker wrote: Personally, I often miss the ability to chain operations on mutable objects, but I can only imagine that that design decision was made for good reason. However, as I teach Python, I find I have nothing to say other than "that's the way it's done in Python". Python has bett

Re: [Python-Dev] Returning None from methods that mutate object state

2014-05-20 Thread Chris Barker
> > [].sort() is None > > True > "ABC".lower() is None > > False > > > > That's a deliberate design choice, and one that has been explained a > > few times on the list when folks ask why "[].sort().reverse()" doesn't > > work when "'ABC'.lower().replace('-', '_')" does. > > > > Would it b

Re: [Python-Dev] Returning None from methods that mutate object state

2014-05-20 Thread Terry Reedy
On 5/19/2014 10:20 AM, Hrvoje Niksic wrote: On 05/17/2014 10:26 AM, Terry Reedy wrote: > When list.pop was added, the convention was changed to > "do not return the 'self' parameter" Do you have a reference for this? I think the fact that Guido accepted, in 2000, my 1999 proposal, with gene

Re: [Python-Dev] Merge conflicts from unmerged 3.4 commits, what do I do?

2014-05-20 Thread Terry Reedy
On 5/19/2014 2:08 AM, Terry Reedy wrote: On 5/19/2014 1:31 AM, Raymond Hettinger wrote: To get my repo back into a usable state, I ran "hg update --clean" py35% hg update --clean % hg update --clean abort: index 00changelog.i unknown format 2! After exiting Workbench and rebooting, update