Metaclasses and class variables

Jan-Ole Esleben esleben at gmail.com
Thu Aug 4 15:54:10 CEST 2005


Yes, that works, but it is unfortunately not an option (at least not a
good one).

Is there no way to create a class variable that exists during
definition of the class? (I cannot imagine there isn't, since
technically it's possible and manually it can be done...)

Ole


> classvar is defined AFTER the class has been created.  So, this should
> work:
> 
> class Test:
>     __metaclass__ = Meta
> 
> Test.classvar.append(1)
> 
> Thomas
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list