Thanks a lot.I've got it.
En Tue, 13 Feb 2007 13:01:59 -0300, <[EMAIL PROTECTED]> escribió:
> But I'm still confused that what's the "real dictionary"?I can't know
> this
> point.Please help and thanks again.
I'm talking about a Python dictionary (a "real" one, as opposed to
UserDic
En Tue, 13 Feb 2007 13:01:59 -0300, <[EMAIL PROTECTED]> escribió:
> But I'm still confused that what's the "real dictionary"?I can't know
> this
> point.Please help and thanks again.
I'm talking about a Python dictionary (a "real" one, as opposed to
UserDict, which is a "fake" dictionary; i
[quote]The idea behind that class is to act "as-if" it were a real
dictionary.
Dicts have an update method, and UserDict should too. But it's not listed
in the book (should appear a few lines below that code); this is a
possible implementation:
def update(self, other):
for key in ot
En Tue, 13 Feb 2007 03:56:21 -0300, <[EMAIL PROTECTED]> escribió:
> I'm reading the book of "Dive into Python" and got these code pieces:
> class UserDict:
> def __init__(self, dict=None): self.data = {}
> if dict is not None: self.update(dict)
> My question is,for the statement of:
I'm reading the book of "Dive into Python" and got these code pieces:
class UserDict:
def __init__(self, dict=None): self.data = {}
if dict is not None: self.update(dict)
My question is,for the statement of:
if dict is not None: self.update(dic
Rory Campbell-Lange wrote:
Hi Steve
I've been playing around with your two suggestions.
The Record class is an elegant solution. It doesn't however help in the
case where the class has the following general data structure (something
I should have stated originally):
class.config1 = param
Hi Steve
I've been playing around with your two suggestions.
The Record class is an elegant solution. It doesn't however help in the
case where the class has the following general data structure (something
I should have stated originally):
class.config1 = param
class.config2 = param
Rory Campbell-Lange wrote:
Hi. I'm just starting to use python.
I am anxious about how best to set and access items one level down in a
data structure if I am using __setitem__ and __getitem__.
At the moment I can do
for a data structure Data:
object.Data = { 'one' : [1, 2, {}, 4],
Anyone out there?
Criticism about the objective of my question, not just the execution,
gratefully received!
Basically, if I have a
class This:
def __init__(self, x, y):
self.x=x
self.y=y
self.data = {}
and then make all my setitem and getitem cal
Hi. I'm just starting to use python.
I am anxious about how best to set and access items one level down in a
data structure if I am using __setitem__ and __getitem__.
At the moment I can do
for a data structure Data:
object.Data = { 'one' : [1, 2, {}, 4],
'two' : [5, 6,
10 matches
Mail list logo