How to automate accessor definition?

kj no.email at please.post
Sun Mar 21 21:36:19 EDT 2010


In <4ba66311$0$27838$c3e8da3 at news.astraweb.com> Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:

>Then, in your __init__ method, to initialise an attribute use:

>    self.__dict__['attr'] = value

>to bypass the setattr.

Ah, that's the trick!  Thanks!

~K



More information about the Python-list mailing list