"linda.s" <[EMAIL PROTECTED]> wrote

> How can I know where a function such as abc is from (from which 
> module)?
>>>> abc
> <built-in function abc>

<Obligitary Lecture>
Look at your import statements.
Provided you have nbeen using recommended practice
you will have used

from module import name1,name2,...

or just

import module.

If the latter you need to access abc as

module.abc

So you know which module its from - thats why its the recommended
approach - after all more than one module may have an abc....

OTOH if you used the non recommended

from module import *

You're left guessing...
</End Lecture :-) >


Although you can use introspection from Python to find out.

try:

>>> import sys
>>> sys.exit
<built-in function exit>
>>> sys.exit.__module__
'sys'
>>>

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld


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

Reply via email to