"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Georg is correct. A list comprehension like: | | [(x * y) for x in seq1 for y in seq2] | | expands to the following in 2.x (% prefixes the compiler's hidden | variables): | | %n = [] | for x in seq1: | for y in seq2: | %n.append(x*y) # Special opcode, not a normal call | | In py3k it expands to: | | def <anon>(outermost): | %0 = [] | for x in outermost: | for y in seq2: | %0.append(x*y) # Special opcode, not a normal call | return %0 | %n = <anon>(seq1)
Why not pass both seq1 *and* seq2 to the function so both become locals? The difference of treatment is quite surprising. _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com