Non-obvious name bindings

Kerim Borchaev warkid at
Mon Nov 5 13:49:52 CET 2001


  It seemed that it was my failure of understanding python but the
  fact that introducing variable in list comprehension binds it to
  functions scope(as every declaration means to?) is not really
  I mean this:
>>> [e for e in ['exists']]
>>> e

  And I'm still confused - those "temporary" variables declaration
  looks so "innocent", and in most cases (in every case for list
  comprehensions I guess?) it's everyones intension not to use this
  variable somewhere outside the loop.

  What are your thoughts?

Best regards,
 Kerim                          mailto:warkid at

More information about the Python-list mailing list