Find out which module a class came from

Tobiah toby at tobiah.org
Fri Apr 7 16:24:58 EDT 2017


I was viewing the python source for a program at work and
came across a class name that I knew my company had written:

	import mycmp1
	import mycmp2
	import mycmp3
	import mycmp4
	import mycmp5

	foo = FooClass()


So I knew that FooClass was defined in one of those imports, but
I thought it would be tedious to track down the location of all
of those modules (is module.__file___ the best way) and scan them
for the class definition.  Is there a better way to find the 
definition of FooClass()?


Thanks!






More information about the Python-list mailing list