Bug in list comprehensions in Pyhton 2.1.1?

Fernando Pérez fperez528 at yahoo.com
Fri Nov 9 21:42:12 EST 2001


Tim Peters wrote:

>> def flatten_bug(seq):
>>     # a *global* variable x is left over after calling this function,
>>     # with the  value of the last element in the return list
>>     return [x for subseq in seq for x in subseq]
> 
> See
> 
> <http://sf.net/tracker/?group_id=5470&atid=105470&func=detail&aid=471928>
> 
> This was a bug, and was fixed last month (for 2.2; perhaps also for 2.1.2).

Thanks for the info! I'll update to 2.2 when it comes out. In the meantime 
there's an easy workaround (as my original post indicated).

Well, at least it's a nano-ego trip to have found a bug in Python after 
having only recently started to use the language :-)

Cheers,

f.



More information about the Python-list mailing list