allow line break at operators

rantingrick rantingrick at gmail.com
Tue Aug 16 20:56:08 CEST 2011


On Aug 16, 1:49 am, alex23 <wuwe... at gmail.com> wrote:
> On Aug 16, 2:37 pm, rantingrick <rantingr... at gmail.com> wrote:
>
> > The reading proceeds naturally from right to left.
>
> Well, "naturally" if you're coding in Hebrew or Japanese perhaps :)

Yes :). I typo-ed that one. It was getting late when i sent that
reply. I did consider posting an edit however i decided not to and
instead, wait and see who would notice.

The map feels much better too as a consequence:

rb> [3,100,-20].map{|x| x.to_f}
[3.0, 100.0, -20.0]

And you can can induce some logic without a clunky lambda.

rb>[3,100,-20].map{|x| if x > 99 then x.to_f else x end}
[3.0, 100.0, -20.0]

in Python you'd have to create a def for that (i know bad "specific"
example but the need is there)

It feels just like a Python list comprehension though:
py> [float(x) for x in [3,100,-20]]

Even though it reads in a non-linear way, you could argue that the
most important part (float(x)). is front-and-center. Of course i like
the compactness of python's map function:

py> map(float, [3,100,-20])

But all too often the map function is insufficient AND you cannot use
map in a chain! If only we could find a happy medium between Python
and Ruby oh what a bliss that would be. We could cut off all of
Pythons warts and destroy all of Rubys multiplicity and "singular
paridigm-ness".

 * Forced indention (exactly one tab, and one tab only!)
 * No multiplicity!
 * Nice linear expressions!
 * Name spaces!
 * Implicit modules!
 * Only "truly heterogeneous" built-in functions allowed!
 * Enough freedom to be expressive, but not enough to allow sloppy-
ness.





More information about the Python-list mailing list