[Tutor] math, cmath and all that ... [module.__file__]

Gregor Lingl glingl@aon.at
Fri, 09 Aug 2002 04:14:34 +0200


Thanks to both of you for your explanations.
Before I asked, I did a (rudimentary) search, but as I'm working on a 
Windows-System
and since I don't have the sources on my machine, I didn't find them.

Danny Yoo schrieb:

>By the way, we can ask a module which file it belongs to:
>
>###
>  
>
>>>>import math
>>>>math.__file__
>>>>        
>>>>
>'/opt/Python-2.1.1/lib/python2.1/lib-dynload/math.so'
>###
>
>On a Windows system, we'll probably see something like
>'math.dll' instead.
>  
>
No:

Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
 >>> import math
 >>> math.__file__
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in ?
    math.__file__
AttributeError: 'module' object has no attribute '__file__'
 >>>

Thanks again, Gregor