How to determine from which module function or class come?

Eugeni Doljenko dolzenko at rsu.ru
Wed Apr 14 02:58:31 EDT 2004


I was confused when some plotting libraries (matplotlib, PyQwt) imported 
whole Numeric in current namespace.
(Numeric redefine cos(), sin() and other math functions to operate 
properly on arrays).
When I type "print cos()" it prints <ufunc....> happily i know about 
UFuncs in numarray and Numeric and so i've found that these functions 
come from Numeric, or numarray.
But I want something like this:

 >>> which some_function
some_module.some_sub_module.some_function
 >>> which some_class
some_module1.some_sub_module1.some_class

i.e. something that shows from which module function or class come.

Obscurely I suspect it's impossible in general, is it so or not?

Sorry for my newbee question and stupid English :)




More information about the Python-list mailing list