Re[2]: [Python-Dev] New and Improved Import Hooks

Paolo Invernizzi Paolo Invernizzi <paoloinvernizzi@dmsware.com>
Thu, 5 Dec 2002 12:21:11 +0100


Hello Fredrik,

Thursday, December 5, 2002, 11:40:52 AM, you wrote:

FL> a solution that won't let you wrap up the standard library isn't much
FL> of a solution (portions of both RE engines are written in Python)

FL> I think this is overkill.  let's keep it simple and grokable.

try / except ? The first succeed is the winner.
I agree with Paul that Gordon's ui is still the best startup point.

from ui.py

        for klass in self.ownertypes:
            try:
                # this may cause an import, which may cause recursion
                # hence the protection
                owner = klass(path)
            except:
                pass
            else:
                break

And, about sys.path, if not plain string/unicode, what's in package
__path__ ?


-- 
Best regards,
 Paolo                            mailto:paoloinvernizzi@dmsware.com