_dict vs __dict__ zodb question
Jaco Smuts
JSmuts at clover.co.za
Tue Nov 9 06:11:22 EST 2004
Hello there
Can anyone please point me to a discussion on the usage of _dict or
__dict__. I am looking at writing custom setAttr methods.
I rather like the idea doing something like this:
def setAttribute(self, attribute, value):
some logic / code
self.__dict__[attribute] = value
However I've come accross a few sites / postings from Google where they
are using _dict and not __dict__.
My guess is that they are using a custom 'private' attribute _dict and
populating it with attributes that may be changed.
Is that correct am I missing something else ?
Any thoughts or hints will be appreciated.
thanks
jaco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20041109/83f65b2c/attachment.html>
More information about the Python-list
mailing list