Postpone creation of attributes until needed

Peter Otten __peter__ at
Mon Jun 11 13:44:10 CEST 2007

Frank Millman wrote:

> I tried that, but I get AttributeError: 'A' object has no attribute
> '__dict__'.

That's what you get for (ab)using __slots__ without understanding the
implications ;)

You can instead invoke the __getattr__() method of the superclass:

super(A, self).__getattr__(name)


More information about the Python-list mailing list