pre-PEP: Suite-Based Keywords

Bengt Richter bokr at oz.net
Tue Apr 19 01:02:10 EDT 2005


On Mon, 18 Apr 2005 14:06:08 -0700, "Robert Brewer" <fumanchu at amor.org> wrote:

>Reinhold Birkenfeld wrote:
>> >y =3D (f(11, 22, x=3D1, y=3D'y for f') *
>> >     g(*args_from_somewhere,
>> >       x=3D'x for g', y=3D'y for g',
>> >       foo=3Dlambda: return 'foo for g'))
>> >
>> >would be my current way to express this. But still, the less lines,
>> >the less confusing it is.
>
>And Ron Adam replied:
>> I would probably do it this way.
>>=20
>> y =3D f(11, 22, x=3D1, y=3D'y for f') 		\
>>          * g( *args_from_somewhere,
>>               x=3D'x for g',=20
>>               y=3D'y for g',
>>               foo=3Dlambda: return 'foo for g' )
>
>Which are both prettier, until you actually try to use them:
>
>>>> g( *args_from_somewhere, x=3D'x for g', y=3D'y for g', foo=3Dlambda:
>return 'foo for g' )
>Traceback (  File "<interactive input>", line 1
>    g( *args_from_somewhere, x=3D'x for g', y=3D'y for g', foo=3Dlambda:
>return 'foo for g' )
>                             ^
>SyntaxError: invalid syntax
>
>
I had a bug too ;-/ No returns in lambda ;-)
Other than that, it compiles, so I suspect the
visual structure helped, even if not so pretty.

Regards,
Bengt Richter



More information about the Python-list mailing list