En Sun, 18 Feb 2007 20:56:48 -0300, Fuzzyman <[EMAIL PROTECTED]> escribió:
> [somebody] wrote: >> >>> > def getCodeName(deap=0): >> >>> > return sys._getframe(deap+1).f_code.co_name >> >> >>> > class MyClass (object): >> >>> > name = getCodeName() + '!' >> >> >>> What's the advantage over MyClass.__name__? >> > I were asking, why do you want a "name" attribute since "__name__" >> > already exists and has the needed information. And worst, using an >> > internal implementation function to do such task. >> >> 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... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list