Bengt Richter wrote:
> On Fri, 03 Feb 2006 20:44:47 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote:
>> funcTakingCallback(x.method(zip, zop) def (x))
>>
>> Consider these comparisons:
>>
> This looks a lot like the "anonymous def" expression in a postfix form ;-)
If you think about the way a for-loop statement maps to the looping portion of
a listcomp or genexp, or the way an if statement maps to a conditional
expression, you might notice that this is *not* a coincidence :)
def g(_seq):
for x in _seq:
yield x*x
g = g(seq)
=> g = (x*x for x in seq)
l = []
for x in seq:
l.append(x*x)
=> l = [x*x for x in seq]
if cond:
val = x
else:
val = y
=> val = x if cond else y
In all three of the recent cases where a particular usage of a statement has
been converted to an expression, the variable portion of the innermost part of
the the first suite is pulled up and placed to the left of the normal
statement keyword. A bracketing syntax is used when the expression creates a
new object. All I'm suggesting is that a similarly inspired syntax is worth
considering when it comes to deferred expressions:
def f(x):
return x*x
=> f = (x*x def (x))
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com