On Tue, Feb 19, 2019 at 01:52:34PM -0800, Brett Cannon wrote:
> On Tue, Feb 19, 2019 at 6:23 AM Jimmy Girardet <i...@netc.fr> wrote:
[...]
> > I would be happy to have
> >
> > >>> [1,2,3].append(4)::sort()::max() +1
> >
> > It makes things very easy to read: first create list, then append 4,
> > then sort, then get the max.
> >
> 
> Easy for you, but not necessarily everyone else. For instance, I find the
> explicit writing out of the lines easier.

That's possibly a matter of familiarity. I'd be very surprised if you 
preferred this:

    mystr = mystr.strip()
    mystr = mystr.expandtabs()
    mystr = mystr.lower()
    mystr = mystr.replace('ham', 'spam')
    result = function(mystr)

over this fluent version:

    result = function(mystr.strip().expandtabs().lower().replace('ham', 'spam'))

Or if you're worried about the line length:

    result = function(mystr.strip()
                           .expandtabs()
                           .lower()
                           .replace('ham', 'spam')
                           )

works for me.


-- 
Steven
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to