allow line break at operators

rantingrick rantingrick at gmail.com
Tue Aug 16 00:37:08 EDT 2011


On Aug 15, 11:13 pm, alex23 <wuwe... at gmail.com> wrote:
> Steven D'Aprano <steve+comp.lang.pyt... at pearwood.info> wrote:
> > I think I would be less skeptical about fluent interfaces if they were
> > written more like Unix shell script pipelines instead of using attribute
> > access notation:
>
> > foo.array_of_things | sort | map block | join ", "
>
> I've seen at least one attempt to provide this in Python:

If you want 100% OOP then use Ruby:

rb> [3,100,-20].sort.join('<#>')
-20<#>3<#>100

Ruby is great from this angle! The reading proceeds naturally from
right to left. I have become accustomed to reading Python's nested
function calls however it does feel much more natural in Ruby. Of
course, there are architectural reasons why Python cannot do this
linear syntactical processing which lends some paradigm-al niceties to
the python programmer that are not available to the Ruby folks.



More information about the Python-list mailing list