Martin v. L=F6wis wrote: > That's quite expensive. Unless I'm mistaken, it causes an additional > stat call per sys.path item (to find out that it is a directory). >=20 > If Just's patch is accepted, you get that feature for free >=20 > import zipimport,sys > sys.path.append(zipimport.zipimporter(sys.argv[0])) >=20 > does what you want. For Jim's patch, I'd say you lose: We should > tighten the PEP saying that only items in sys.path are treated as > zipfiles that have ".zip" in their name (with a yet-to-be-specified > separator for putting directory in the zipfile into sys.path). Note that I'm currently working on a variation of the patch that implemen= ts a subset of iu.py (I think I mentioned this a few times already ;-). For ea= ch path item, each item in a list of hooks is asked whether it can handle the pat= h item; the first one that can is used. This is done *once* per path item, the re= sults are cached in a dict (iu's shadowpath): {path_item: path_handler, ...}. T= his gives the zipimporter a chance no matter what the extension is and it's s= till cheap as it's only done once. Just
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4