On 05Apr2012 19:13, Alain Ketterlin <al...@dpt-info.u-strasbg.fr> wrote:
| Miki Tebeka <miki.teb...@gmail.com> writes:
| > (Note that I want over http://wiki.python.org/moin/PythonWarts already).
| 
| The "local variable and scoping" is, imho, something to be really
| careful about. Here is an example:
| 
| class A(object):
|     def __init__(self):
|         self.x = 0
|     def r(self):
|         return x # forgot self
| 
| a = A()
| x = 1
| print a.r() # prints 1
| 
| I know there is "no remedy". It's just really tricky.

Whoa!

I presume this jost happens with globals and not with one function
calling another... (I guess I should test that instead of asking such a
dumb question).
-- 
Cameron Simpson <c...@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

You see, wire telegraph is a kind of a very, very long cat. You pull his tail
in New York and his head is meowing in Los Angeles. Do you understand this?
And radio operates exactly the same way: you send signals here, they receive
them there. The only difference is that there is no cat.
- Albert Einstein, when asked to describe radio
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to