Tim Johnson wrote:
> I was pleasantly surprised to notice in a previous thread that python
> can automagically retrieve a class name thru __class__.__name__
> 1)Can someone point me to further documentation on this topic?

__name__ and __module__ at least are documented here:
http://docs.python.org/ref/types.html#l2h-118

You can also try dir(type) to see attributes of type 'type', the base class of 
all 
new-style classes, or dir(A) for any class A to see attributes of the class. 
Many of the 
special attributes (__xxx__) are referenced in the index to the Python 
Reference Manual.
http://docs.python.org/ref/genindex.html

> 2)Is it possible for the name of a class method to be 
>   programmatically retrieved from within the scope of the method?
>   If so, how? and pointers to docs would be welcome also.

You can look at the stack frame to find out what method you are in. See for 
example
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062

Kent

> 
> thanks


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to