On Tuesday 18 August 2009 21:44:55 Pavel Panchekha wrote:
I want a dictionary that will transparently inherit from a parent
dictionary. So, for example:
a = InheritDict({1: one, 2: two, 4: four})
b = InheritDict({3: three, 4: foobar}, inherit_from=a)
a[1] # one
a[4] # four
b[1] # one
I want a dictionary that will transparently inherit from a parent
dictionary. So, for example:
a = InheritDict({1: one, 2: two, 4: four})
b = InheritDict({3: three, 4: foobar}, inherit_from=a)
a[1] # one
a[4] # four
b[1] # one
b[3] # three
b[4] # foobar
I've written something like this in
18-08-2009 o 21:44:55 Pavel Panchekha pavpanche...@gmail.com wrote:
I want a dictionary that will transparently inherit from a parent
dictionary. So, for example:
a = InheritDict({1: one, 2: two, 4: four})
b = InheritDict({3: three, 4: foobar}, inherit_from=a)
a[1] # one
a[4] # four
b[1] #
On Tue, Aug 18, 2009 at 2:44 PM, Pavel Panchekha pavpanche...@gmail.comwrote:
I want a dictionary that will transparently inherit from a parent
dictionary. So, for example:
a = InheritDict({1: one, 2: two, 4: four})
b = InheritDict({3: three, 4: foobar}, inherit_from=a)
a[1] # one
a[4]
On Aug 18, 4:23 pm, Jan Kaliszewski z...@chopin.edu.pl wrote:
18-08-2009 o 21:44:55 Pavel Panchekha pavpanche...@gmail.com wrote:
I want a dictionary that will transparently inherit from a parent
dictionary. So, for example:
a = InheritDict({1: one, 2: two, 4: four})
b =
18-08-2009 o 22:27:41 Nat Williams nat.willi...@gmail.com wrote:
On Tue, Aug 18, 2009 at 2:44 PM, Pavel Panchekha
pavpanche...@gmail.comwrote:
I want a dictionary that will transparently inherit from a parent
dictionary. So, for example:
a = InheritDict({1: one, 2: two, 4: four})
b =
On Aug 18, 5:11 pm, Jan Kaliszewski z...@chopin.edu.pl wrote:
18-08-2009 o 22:27:41 Nat Williams nat.willi...@gmail.com wrote:
On Tue, Aug 18, 2009 at 2:44 PM, Pavel Panchekha
pavpanche...@gmail.comwrote:
I want a dictionary that will transparently inherit from a parent
dictionary.
On Tue, Aug 18, 2009 at 6:08 PM, Simon Formansajmik...@gmail.com wrote:
On Aug 18, 3:44 pm, Pavel Panchekha pavpanche...@gmail.com wrote:
I want a dictionary that will transparently inherit from a parent
dictionary. So, for example:
a = InheritDict({1: one, 2: two, 4: four})
b =
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', '2': '2'}
print
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()
c2 = child2()
print c1.dic
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
11 matches
Mail list logo