[Python-Dev] Ruby-style Blocks in Python
Henning von Bargen
henning.vonbargen at arcor.de
Sun Mar 8 18:53:04 CET 2009
I totally agree with Matthew.
I don't understand the code at first sight.
The "with ... do ..." syntax breaks the
"Python is executable pseudo-code" pattern.
And according the example given at Tav's web site:
with employees.select do (emp):
if emp.salary > developer.salary:
return fireEmployee(emp)
else:
return extendContract(emp)
It is neither shorter nor clearer than the same thing with existing Python
syntax:
for emp in employees.select:
# or should it be "select()"?
if emp.salary > developer.salary:
fireEmployee(emp)
else:
extendContract(emp)
BTW it seems to me that Python development might go the wrong direction.
Using Python for the development of commercial programs for years,
I never felt the need to use anything more complicated than generators or
decorators.
Security, performance, and the "batteries included" are by far more
important
than esotheric features which Joe Average doesn't understand anyway
(and therefore hopefully won't use it).
If there's anything where Python should be improved, it's static code
analysis
(like pylint) in the standard lib and optional type declarations, which
could be
used to assist pylint and friends as well as JIT compilers, Cython,....
and not even more Meta-thingies.
Sorry, I just had to say this once.
Henning
More information about the Python-Dev
mailing list