__dict__ is an attribute of every Python object. It's typically only an internal detail, and generally not accessed directly. One area where __dict__ modification would differ from attribute access is with an attribute that's a property. Modifying the __dict__ would ignore the property getter/setter code, where as modifying the attribute will still invoke those methods. In other words, __dict__ manipulation breaks encapsulation ... although in rare cases this is what you want to do!
>>> class Foo(object): pass ... >>> f = Foo() >>> f.__dict__ {} >>> f.cat = 'dog' >>> f.__dict__ {'cat': 'dog'} >>> f.__dict__['cow'] = 'moo' >>> f.cow 'moo' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---