Getting a class name

Gabriel Genellina gagsl-py at yahoo.com.ar
Mon Feb 19 20:05:04 EST 2007


En Mon, 19 Feb 2007 17:25:56 -0300, Fuzzyman <fuzzyman at gmail.com> escribió:

> On Feb 19, 5:11 am, "Gabriel Genellina" <gagsl... at yahoo.com.ar> wrote:
>> En Sun, 18 Feb 2007 20:56:48 -0300, Fuzzyman <fuzzy... at gmail.com>  
>> escribió:
>> > [somebody] wrote:
>> >> >>> > def getCodeName(deap=0):
>> >> >>> >     return sys._getframe(deap+1).f_code.co_name
>>
>> >> This might be useful to avoid metaclass hacks when trying to  
>> initialize
>> >> a class attribute that would require the class name. (my 2 cents)
>>
>> > It's still an ugly hack. :-)
>> > (But a nice implementation detail to know about none-the-less.)
>>
>> Having class decorators would be nice...
>
> Yes - and Guido said he wouldn't be opposed to the idea when it was
> poitned out that they would be very useful for both IronPython and
> Jython to implement features of their underlying platforms.
>
> I haven't heard anyone (other than you) mention them recently
> though...

Maybe it's a sign that actually nobody cares about class decorators :(

-- 
Gabriel Genellina




More information about the Python-list mailing list