Method Chaining

Michael Selik michael.selik at gmail.com
Fri Jun 17 19:10:10 EDT 2016


On Fri, Jun 17, 2016, 6:44 PM Michael Selik <michael.selik at gmail.com> wrote:

>
>
> On Fri, Jun 17, 2016, 6:42 PM Lawrence D’Oliveiro <lawrencedo99 at gmail.com>
> wrote:
>
>> On Saturday, June 18, 2016 at 1:35:06 AM UTC+12, Michael Selik wrote:
>>
>> > The chained version looks like each method is returning a modified
>> > copy.
>>
>> As opposed to a modified original?
>>
>
> Correct. Read the rationale for list.sort returning None. It's in the
> Python design FAQ.
>

Sorry, I should have included the link.

https://docs.python.org/2/faq/design.html#why-doesn-t-list-sort-return-the-sorted-list

Even if we're talking about a non-mutation side-effect, I think the same
rationale applies.


More information about the Python-list mailing list