[Python-3000] yes to class decorators

tomer filiba tomerfiliba at gmail.com
Thu Nov 16 12:24:13 CET 2006


several things:

[Josiah]
> I believe that Tomer just wanted to remind people that class decorators
> are slated for 2.6 and 3.0 if there was a PEP, and perhaps that he is
> encouraging someone to write one.

yeah, i just wanted to bring it up again. however, i do have some
spare time at the moment, so i can write the pep myself.
but before someone writes a pep, it's better to discuss the issue
at hand.

currently, to my understanding, this is what we have:

("@" expression "\n")*
"class" name ["(" expression "):"]
    clause

we should find some more/better use-cases than what i came
up with, and show why class decorators are the right solution,
and compare with function decorators.

we should also note that it's possible to replace "__metaclass__"
by a @metaclass decorator. of course this requires more thinking.

- - - - - - - - -

[Jack Diederich]
> I realize this is the py3k list and asking people to keep their
> crazy to themselves is an act of utopian optimism but I'm asking
> anyway.

MWHAHAAHAHAHAHAHAHA!!!111!!^&%^#%&@
*shoves own hand into the oven*

> Did I mention I care about this feature and don't want
> a raft of crazies screwing it up with their own vices?

i don't get your point. i DID read many posts about class
decorators, the most recent of which i've seen were at least half
a year old.  since we have Guido's blessing on the subject,
i wanted to get the wheels moving.

of course i couldn't read EVERYTHING that was said about
class decorators, so i added a couple of use-cases i found.
in fact, the reason why i posted yesterday was because i wrote a
singleton class, and wished i had @singleton instead of

class Foo(object):
    pass
Foo = Foo()

so if we put aside your Stalinistic behavior for the moment,
do YOU want to write the pep? please do.

i don't see why this thread bothers you so much, but you could
have prevented it by writing a pep months ago.
now isn't that motivating? :)


-tomer


More information about the Python-3000 mailing list