class declaration shortcut
usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Mar 1 10:44:48 CET 2007
Michele Simionato wrote:
> On Mar 1, 9:40 am, Marc 'BlackJack' Rintsch <bj_... at gmx.net>
>> In <54msaoF21c6h... at mid.individual.net>, Bjoern Schliessmann
>>> But what's it (__name__) good for?
>> As objects don't know to which name they are bound, that's a good
>> way to give some information in stack traces or when doing
> Also, the name is used by pickle to find the class of pickled
Mh. I suspect there's also more to it than I see now, but this
__name__ seems quite useless to me. What if I rebind the class'
name after definition? Or is it really just for some manual
introspection? If it is, it seems a bit of an overkill to me.
>>> class Spam(object):
>>> Ham = Spam
>>> Spam = 0
>>> test = Ham()
BOFH excuse #137:
User was distributing pornography on server; system seized by FBI.
More information about the Python-list