I want to create a class called DefaultAttr which returns a default value for all attributes which haven't been given values yet. It will work like this:

>> x = DefaultAttr(99)
>> print x.foo
99
>> print x.bar
99
>> x.foo = 7
>> print x.foo
7

I already have a similar class called DefaultDict which works similarly which I assume would be a good thing to use.

Lowell
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to