Newbie question about Class

JStoneGT at aol.com JStoneGT at aol.com
Tue Feb 13 01:56:21 EST 2007


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(dict)
 
Why it's not this one below?
 
if dict is not None: self.data.update(dict)
 
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070213/d9299606/attachment.html>


More information about the Python-list mailing list