[Python-ideas] Ruby-style Blocks in Python Idea

Torsten Bronger bronger at physik.rwth-aachen.de
Mon Mar 9 17:22:18 CET 2009


tav writes:

> Hey Aahz,
>> The trick to getting features for functional programming accepted
>> is to make them look as Pythonic as possible.
> I spent considerable effort to make the using/do statement as
> Pythonic as possible.
> Could you please elaborate on what you don't like about it?

Two things for me: The "using ..." is not well-readable.  The
"(employee)" sits clumsily at the end of the line whithout any
connection to the rest.  Even worse, the "do" anticipates the ":",
which in Python already means "do".

And secondly, I'm not comfortable with the fact that the return
value is the first (or last? or all?) expression the interpreter
stumbles over.  Because Python distinguishs between expressions and
statements, you have to look twice to see what actually happens in
the block.  In other words, expressions work differently in these
almost-functions, so we end up with two kinds of functions that have
different semantic rules.  This makes reading more difficult, as
well as code-reuse.


Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bronger at jabber.rwth-aachen.de

More information about the Python-ideas mailing list