On Fri, 17 Apr 2009 17:48:55 +0200, Diez B. Roggisch wrote:
> No, because you are creating *classvariables* when declaring things like
> this:
...
> OTOH, when assigning to an instance, this will create an
> *instance*-variable. Which is what
If an integer variable is an integer, and a string va
Dominik Ruf wrote:
> Hi,
>
> I just stumbled upon the following behaviour.
class base():
> ... dic = {'1':'1', '2':'2'}
> ...
class child1(base):
> ... def __init__(self):
> ... self.dic.update({'1':'2'})
> ...
class child2(base):
> ... pass
> ...
c1 = child1()
Hi,
I just stumbled upon the following behaviour.
>>> class base():
... dic = {'1':'1', '2':'2'}
...
>>> class child1(base):
... def __init__(self):
... self.dic.update({'1':'2'})
...
>>> class child2(base):
... pass
...
>>> c1 = child1()
>>> c2 = child2()
>>>
>>> print c1.dic
{'1': '2',