List Comprehensions Enhancement

William Tanksley wtanksle at dolphin.openprojects.net
Tue Sep 14 21:00:10 EDT 1999


On 15 Sep 1999 00:07:29 +0200, Magnus L. Hetland wrote:
>philh at vision25.demon.co.uk (Phil Hunt) writes:
>>            wtanksle at dolphin.openprojects.net "William Tanksley" writes:

>> > >print [(i,s) for i in nums, for s in strs]
>> > >or similar.

>> > I agree -- my initial reaction was to put 'and' as the seperator.  Amazing
>> > how great minds think alike :).

>> > print [(i,s) for i in nums and for s in strs]

>> That's horrible. ``and'' already means something in Python.

>And? So does for and in...

This (together with a sense of injured pride ;-) was my initial reaction
as well.  However, it's possible that he was trying to point
out that 'and' can have a meaning in that position -- this would make
parsing comprehensions a little harder (it would require lookahead).
That's sufficient argument for me -- I don't want to be remembered as
arguing for stupid features :).

However, Phil, I think you'll have to agree that you COULD have phrased
your "rebuttal" a little bit more diplomatically or comprehensibly.

>  Magnus

-- 
-William "Billy" Tanksley




More information about the Python-list mailing list