[Python-ideas] add fluent operator to everything
Bruce Leban
bruce at leban.us
Wed Feb 20 14:15:51 EST 2019
On Wed, Feb 20, 2019 at 11:03 AM Rhodri James <rhodri at kynesim.co.uk> wrote:
> On 20/02/2019 18:24, Bruce Leban wrote:
> > a = [1,2,3]
> > ( _:= a ,_ .append(4) ,_ .sort() )
>
> I'm not sure what problem you are solving here, but if that's the
> solution I'd rather have the problem. There is absolutely nothing in
> that syntax that suggests what's going on.
>
>
Given the responses, I think I was a bug more obtuse than necessary. My
apologies.
This is already in Python 3.8. I am NOT actually suggesting a change to the
language. I'm showing how to "solve" the "problem" of wanting to write
chained method calls on a single line. I agree the solution is unreadable
and worse than the problem. Any other proposed solution is merely
bikeshedding the syntax and I think suffers from the same non-readability
problem. For example these are essentially the same:
_:= a ,_. append(4) ,_. sort()
a :: append(4) :: sort()
--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190220/9a5b630b/attachment-0001.html>
More information about the Python-ideas
mailing list