[Python-Dev] Lazy importing (was Rethinking intern() and its data structure) (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 11 02:41:14 CEST 2009
- Previous message: [Python-Dev] Rethinking intern() and its data structure
- Next message: [Python-Dev] Rethinking intern() and its data structure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan wrote:
I sometimes wish for a nice, solid lazy module import mechanism that manages to avoid the potential deadlock problems created by using import statements inside functions.
I created an ad-hoc one of these for PyGUI recently. I can send you the code if you're interested.
I didn't have any problems with deadlocks, but I did find one rather annoying problem. It seems that an exception occurring at certain times during the import process gets swallowed and turned into a generic ImportError. I had to resort to catching exceptions and printing my own traceback in order to diagnose missing auto-imported names.
-- Greg
- Previous message: [Python-Dev] Rethinking intern() and its data structure
- Next message: [Python-Dev] Rethinking intern() and its data structure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]