In <[EMAIL PROTECTED]>, K.S.Sreeram
wrote:
>> BTW, if that's what gangesmaster is after then it seem to work already.
>> Put ``(object)`` after ``X`` and return something, say 'a' and 'b', in the
>> getters and the example prints 'a' and 'b'.
>
> btw, the example seems to work even with old-styl
Marc 'BlackJack' Rintsch wrote:
> K.S.Sreeram wrote:
>> The very fact that you can put a loop inside __metaclass__ may be reason
>> enough for a one-off metaclass.
>
> Ah, it's not the loop but the access to the `dict`! You can write loops
> at class level too but I haven't found a way to access
In <[EMAIL PROTECTED]>, K.S.Sreeram
wrote:
> Marc 'BlackJack' Rintsch wrote:
>> But why use a metaclass? If the meta class is only applied to *one*
>> class, can't you do at class level whatever the metaclass is doing!?
>
> The very fact that you can put a loop inside __metaclass__ may be reason
Marc 'BlackJack' Rintsch wrote:
> But why use a metaclass? If the meta class is only applied to *one*
> class, can't you do at class level whatever the metaclass is doing!?
The very fact that you can put a loop inside __metaclass__ may be reason
enough for a one-off metaclass.
Here's a contrived
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> In <[EMAIL PROTECTED]>, gangesmaster
> wrote:
>
> > just something i thought looked nice and wanted to share with the rest
> > of you:
> >
> class x(object):
> > ... def __metaclass__(name, bases, dict):
> > ... print "he
In <[EMAIL PROTECTED]>, gangesmaster
wrote:
> just something i thought looked nice and wanted to share with the rest
> of you:
>
class x(object):
> ... def __metaclass__(name, bases, dict):
> ... print "hello"
> ... return type(name, bases, dict)
> ...
> hello
>>>
just something i thought looked nice and wanted to share with the rest
of you:
>>> class x(object):
... def __metaclass__(name, bases, dict):
... print "hello"
... return type(name, bases, dict)
...
hello
>>>
instead of defining a separate metaclass function/class, you