[Tutor] module.class.method in logging.debug

spir denis.spir at gmail.com
Mon Mar 15 20:41:43 CET 2010


On Mon, 15 Mar 2010 13:26:27 -0400
Brian Jones <bkjones at gmail.com> wrote:

> I tried a couple of things I could think of, and successfully got the module
> and class without issue, but the one missing piece was the method name.

All methods and funcs (and types) have a __name__ attr.

from types import FunctionType as Function

def f1(): pass
def f2(): pass
def f3(): pass

for (name,obj) in vars().items():
	if type(obj) is Function:
		print obj.__name__,

==> f1 f2 f3

Denis
________________________________

la vita e estrany

spir.wikidot.com



More information about the Tutor mailing list