__dict__ attribute for built-in types

Nobody nobody at nowhere.com
Fri Oct 28 01:49:08 EDT 2011


On Thu, 27 Oct 2011 12:08:45 +0200, candide wrote:

> I realize that built-in types objects don't provide a __dict__ attribute 
> and thereby i can't set an attribute to a such object, for instance

Note that possession or absence of a __dict__ attribute doesn't
necessarily mean that you can or can't set attributes, as the class can
override __setattr__().

Ultimately, there is no guaranteed mechanism to determine in advance
whether or not an attempt to set an attribute will succeed.




More information about the Python-list mailing list