[ python-Bugs-1708326 ] imp.find_module doc ambiguity

SourceForge.net noreply at sourceforge.net
Tue May 1 20:23:24 CEST 2007


Bugs item #1708326, was opened at 2007-04-26 12:18
Message generated for change (Settings changed) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1708326&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andrew McNabb (amcnabb)
Assigned to: Nobody/Anonymous (nobody)
>Summary: imp.find_module doc ambiguity

Initial Comment:
The doc string for find_module doesn't make it clear that you can do:

stats_path = imp.find_module('scipy/stats')

It makes it sound like you would have to do:

scipy_path = imp.find_module('scipy')[1]
stats_path = imp.find_module('scipy', stats_path)[1]

However, the shorter snippet seems to work just fine.

----------------------------------------------------------------------

Comment By: Jim Jewett (jimjjewett)
Date: 2007-05-01 06:48

Message:
Logged In: YES 
user_id=764593
Originator: NO

Are you sure it works the same?  I would expect that 

(1)  The longer form first finds a module (or package) named scipy, then
finds the (sub-)module stats within it.  The shortcut form might not
provide enough of the scipy context.  (Whether this actually matters
probably depends on what stats does, how much it depends on the rest of
scipy, and what you need it for.)

(2)  The longer form would work using python abstractions, while the short
form would depend on how files happened to be stored on your machine.  Your
storage format is fairly common, but not guaranteed.  For example, would
the short form work on windows, where directory slashes (sometimes) need to
go the other direction?  Would it work if scipy were in a zipfile egg?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1708326&group_id=5470


More information about the Python-bugs-list mailing list