Newbie question about Class
JStoneGT at aol.com
JStoneGT at aol.com
Tue Feb 13 21:16:29 EST 2007
Thanks a lot.I've got it.
En Tue, 13 Feb 2007 13:01:59 -0300, <JStoneGT at aol.com> 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; it looks and acts like a
dictionary but it's not).
py> from UserDict import UserDict
py> d = {"a": 1, "b": 2, "c": 3} # This is a "real" dictionary
# I create an UserDict instance, its initial contents come from a
dictionary
py> ud1 = UserDict(d)
py> ud1
{'b': 2, 'a': 1, 'c': 3}
# Now I create a second UserDict instance, its initial contents come from
the UserDict instance
py> ud2 = UserDict(ud1)
py> ud2
{'b': 2, 'a': 1, 'c': 3}
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070213/e444d769/attachment.html>
More information about the Python-list
mailing list