class declaration shortcut

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Thu Mar 1 03:40:12 EST 2007


In <54msaoF21c6h3U3 at mid.individual.net>, Bjoern Schliessmann wrote:

> Bruno Desthuilliers wrote:
> 
>> class Toto(object):
>>      pass
>> 
>> print Toto.__name__
> 
> Okay, I revoke my statement and assert the opposite.
> 
> 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 introspection.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list