On Sat, Dec 1, 2012 at 3:05 AM, andrea crotti <andrea.crott...@gmail.com> wrote: > Well I knew that this works fine, even if I feel a bit guilty to do > this, and better is: > > foo = 'bar' if some_condition else 'baz' > > Anyway for me the suprise is that something that is defined *later* at > the module scope is found in a function which is defined *earlier*.
It's assigned to earlier. It's no different from C code like this: int foo; void blah() { /* do stuff with foo */ } int main() { foo = 1; } In Python, the "int foo;" is implicit, but the scope is the same. ChrisA -- http://mail.python.org/mailman/listinfo/python-list