On Thu, 4 Aug 2005 17:53:28 +0200, Jan-Ole Esleben <[EMAIL PROTECTED]> wrote:
>Thanks! It's a bit icky, yes, but I've been so wrapped up in
>complicated thinking that I didn't see this. It's actually quite an
>OK solution (I need it because I have an internal representation for
>method interfaces
Thanks! It's a bit icky, yes, but I've been so wrapped up in
complicated thinking that I didn't see this. It's actually quite an
OK solution (I need it because I have an internal representation for
method interfaces that needs to be saved somewhere without the user
having to worry about it, and wi
Jan-Ole Esleben wrote:
>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...)
>
>O
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
Christopher Subich wrote:
> Jan-Ole Esleben wrote:
>
>> class Meta(type):
>> def __new__(cls, name, bases, d):
>> d['classvar'] = []
>> return type.__new__(cls, name, bases, d)
>
>
> The problem is that __new__ is called upon object construction, not
> class definition, but you're try
Jan-Ole Esleben <[EMAIL PROTECTED]> writes:
> Hi!
>
> I am new to this list, and maybe this is a stupid question, but I
> can't seem to find _any_ kind of answer anywhere.
>
> What I want to do is the following:
> I want to insert a class variable into a class upon definition and
> actually use it
I thought __new__ was called upon construction of the _class_ object
that "Meta" is the type of. Then it would be available at the time of
the definition of my class. Or am I mistaken?
Ole
2005/8/4, Christopher Subich <[EMAIL PROTECTED]>:
> Jan-Ole Esleben wrote:
> > class Meta(type):
> > def _
Jan-Ole Esleben wrote:
> class Meta(type):
> def __new__(cls, name, bases, d):
> d['classvar'] = []
> return type.__new__(cls, name, bases, d)
The problem is that __new__ is called upon object construction, not
class definition, but you're trying to set the class variables at
definitio