__dict__ is neato torpedo!
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Jun 12 04:47:01 EDT 2011
More information about the Python-list mailing list
Sun Jun 12 04:47:01 EDT 2011
- Previous message (by thread): __dict__ is neato torpedo!
- Next message (by thread): __dict__ is neato torpedo!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 11 Jun 2011 21:28:40 -0500, Andrew Berg wrote: > On 2011.06.11 09:13 PM, Steven D'Aprano wrote: >> A second, more subtle risk: not all objects have a __dict__. But if you >> obey the rule about never updating from arbitrary objects you don't >> know, then you won't be surprised by an object with no __dict__. > > What objects don't (other than the obvious ones like strings, > dictionaries, ints and lists)? namedtuple is another common example. In pure Python, objects created using __slots__ usually don't have a __dict__. Quite possibly C extension objects. There may be others. -- Steven
- Previous message (by thread): __dict__ is neato torpedo!
- Next message (by thread): __dict__ is neato torpedo!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list