When is a module imported from the standard library?

cary miller cmiller at math.cudenver.edu
Thu Aug 23 01:10:28 CEST 2001

On Wed, 22 Aug 2001, Skip Montanaro wrote:

>     cary> is simplest if you only want to know about the os module.  To get
>     cary> the location of any module do this:
>     cary> mod = os
>     cary> os.path.dirname(eval(mod.__name__).__file__)
> Why the eval?  Why not simply
>     os.path.dirname(mod.__file__)

You are right, the eval is totally useless.  Nevermind.

More information about the Python-list mailing list