Thanks all,
Now I need to try to sum this all up to present to my students. ;-)
-Chris
On Tue, May 20, 2014 at 4:56 PM, Terry Reedy wrote:
> On 5/20/2014 12:30 PM, Chris Barker wrote:
>
>> [].sort() is None
>> > True
>> "ABC".lower() is None
>> > False
>>
>
>
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
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
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
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
>
> [].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
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
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? It is my understanding that the
convention is for mutators to return None, in order to make it clear
that the change is de
Please preserve the tradition. Adding it to PEP 8 sounds good!
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.co
On Sat, May 17, 2014 at 6:14 AM, Nick Coghlan wrote:
> During a conversation today, I realised that the convention of
> returning None from methods that change an object's state isn't
> captured the Programming Recommendations section of PEP 8.
> Specifically, I'm referring to this behaviour:
>
>>
On 17 May 2014 19:56, "Antoine Pitrou" wrote:
>
> On Sat, 17 May 2014 15:14:00 +1000
> Nick Coghlan wrote:
> > During a conversation today, I realised that the convention of
> > returning None from methods that change an object's state isn't
> > captured the Programming Recommendations section of
On Sat, May 17, 2014 at 04:26:12AM -0400, Terry Reedy wrote:
> On 5/17/2014 1:14 AM, Nick Coghlan wrote:
> >During a conversation today, I realised that the convention of
> >returning None from methods that change an object's state isn't
> >captured the Programming Recommendations section of PEP 8.
On Sat, 17 May 2014 15:14:00 +1000
Nick Coghlan wrote:
> During a conversation today, I realised that the convention of
> returning None from methods that change an object's state isn't
> captured the Programming Recommendations section of PEP 8.
This is more an API design guideline than a progra
On 17 May 2014 18:26, Terry Reedy wrote:
> On 5/17/2014 1:14 AM, Nick Coghlan wrote:
>>
>> During a conversation today, I realised that the convention of
>> returning None from methods that change an object's state isn't
>> captured the Programming Recommendations section of PEP 8.
>> Specifically
On 5/17/2014 1:14 AM, Nick Coghlan wrote:
During a conversation today, I realised that the convention of
returning None from methods that change an object's state isn't
captured the Programming Recommendations section of PEP 8.
Specifically, I'm referring to this behaviour:
[].sort() is None
T
During a conversation today, I realised that the convention of
returning None from methods that change an object's state isn't
captured the Programming Recommendations section of PEP 8.
Specifically, I'm referring to this behaviour:
>>> [].sort() is None
True
>>> "ABC".lower() is None
False
That'
16 matches
Mail list logo