What do you want in a new web framework?
Kay Schluehr
kay.schluehr at gmx.net
Wed Aug 30 06:35:11 EDT 2006
Cliff Wells wrote:
> My single wishlist item (which will probably never happen) is actually
> the *removal* of a single "feature": the distinction between statements
> and expressions. Forget list comprehensions, ternary operators, etc.
> You get them with no additional syntax in expression-based languages. I
> played with Logix a bit (but sadly the project appears dead) and the
> expression-based Python syntax it provides gives me goose-bumps.
Ironically I would prefer to turn Logix block expressions of the kind
var = expression:
SUITE
into statements to avoid deep and awkward nestings: passing the
side-effect created by SUITE to var but preserving the distinction
between expressions and block statements nevertheless. I'm not yet sure
if the Python 2.5 with-stmt cannot be used for exactly this purpose?
Note that I'm not completely against blurring the distinction between
expressions and statements in Python. The Python grammar itself
contains a basic distinction between statements namely simple_stmt and
compound_stmt nodes.
Simple statements are defined by:
simple_stmt: small_stmt ( ";" small_stmt)* [";"] NEWLINE
where small_stmt nodes are nodes for assert, print, raise, return,
assignment etc.
It took me an evening using EasyExtend to define an enhanced lambda
that enables expressions like:
lambda lst: s = sum(lst); return float(s)/len(lst)
or
lambda x: print x; x+1
which are other Logix examples.
More information about the Python-list
mailing list