Scope of variable inside list comprehensions?

Roy Smith roy at panix.com
Mon Dec 5 14:15:04 EST 2011


Hmmm, the use of id was just a simplification for the sake of posting.  The real code is a bit more complicated and used a different variable name, but that's a good point.

As far as storing the value in the exception, unfortunately, DoesNotExist is not my exception; it comes from deep within django.  I'm just passing it along.



More information about the Python-list mailing list