stretching list comprehensions
simonb at webone.com.au
Tue Aug 12 02:04:30 CEST 2003
On Mon, 11 Aug 2003 16:44:52 -0700, David Eppstein wrote:
> In article <pan.2003.08.11.23.26.39.60449 at webone.com.au>,
> Simon Burton <simonb at webone.com.au> wrote:
>> >>> del y
>> >>> nums = [ x+y for x in range(y) for y in range(10) ]
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> NameError: name 'y' is not defined
>> Well.. Is there an inherent reason why this could/should not be made to work?
> It does work with the loops in the opposite order:
It seems the wrong order to my "innermost first" mind. Guess i'm changing
More information about the Python-list