[Python-Dev] Don't set local variable in a list comprehension or generator (original) (raw)
skip at pobox.com skip at pobox.com
Fri May 20 01:47:57 CEST 2011
- Previous message: [Python-Dev] Don't set local variable in a list comprehension or generator
- Next message: [Python-Dev] Don't set local variable in a list comprehension or generator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 5/18/2011 10:19 AM, Nadeem Vawda wrote:
I'm not sure why you would encounter code like that in the first place. Surely any code of the form:
''.join(c for c in mystring) would just return mystring? Or am I missing something?
You might more-or-less legitimately encounter it if the generator expression originally contained a condition which got removed.
Skip
- Previous message: [Python-Dev] Don't set local variable in a list comprehension or generator
- Next message: [Python-Dev] Don't set local variable in a list comprehension or generator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]