Re: [Tutor] Python scope and variable binding

2013-11-29 Thread spir
On 11/29/2013 06:20 AM, eryksun wrote: On Wed, Nov 27, 2013 at 10:04 AM, Arnaud Legout wrote: [...] For what it's worth, a personal point of view on Python class defs. I ended up undertanding class definitions as code blocks the following way: Imagine Python has kinds of free sections of co

Re: [Tutor] Python scope and variable binding

2013-11-28 Thread eryksun
On Wed, Nov 27, 2013 at 10:04 AM, Arnaud Legout wrote: > > example 4: > > x = "x in module" > class A(): > print "A: " + x > x = "x in A" > print "A: " + x > print locals() > del x > print locals() > print "A: " + x > A: x in module > A: x in A > {'x': 'x in A', '_

[Tutor] Python scope and variable binding

2013-11-27 Thread Arnaud Legout
Hi, I have some experience on Python programming, but I have hard time to understand to full variable and attribute lookup in Python in corner cases. This mail will be a bit long with many examples, but I hope it will help me and others to better grasp the full story of variables and attribute lo