In <[EMAIL PROTECTED]>, Kay Schluehr
wrote:
> [EMAIL PROTECTED] wrote:
>
>> Many have complained about this crippled-ness of lambda, but it
>> actually makes some sense. Since Python uses colons and indentation to
>> define blocks of code, it would be awkward to close a multiline lambda.
>> The best I could think of would look like
>>
>> deferred.addCallback(lambda r:
>> print("fancy formatting %s" % r.text)
>> )
>>
>> ^
>> |
>>
>> That trailing paranthesis is WAY un-Pythonic.
>
> Maybe it is not common place because some users are underinformed and
> hypnotized by whitespace semantics but you can add a trailing backslash
> to achieve line coninuation within a single expression:
>
>>>> deferred.addCallback(lambda r: puts("fancy formatting %s" \
> ... ))
>
> This works syntactically.
It works just fine without the trailing backslash. A "logical line" does
not end until all opened parenthesis and brackets are matched by their
closing counterpart.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list