setattr in class

Bojan Mihelac bmihelac at gmail.com
Fri Sep 12 17:30:18 CEST 2008


On Sep 12, 5:21 pm, Christian Heimes <li... at cheimes.de> wrote:
> Bojan Mihelac wrote:
> > I guess A class not yet exists in line 4. Is it possible to achive
> > adding dynamic attributes without using exec?
>
> Correct, the class doesn't exist until the end of the class body. You
> can either do it outside the class definition or you can use a metaclass.
>
> Christian

thanks, can you give example on using a metaclass?



More information about the Python-list mailing list