Guido van Rossum <guido@python.org> writes: > - Nobody remembers why there is a special case in site.py for lines in > the .pth file that start with 'import', except that Martin von > Loewis once wanted this. It serves the deployment of packages: you can have code that is run from site.py, by just installing a file. This is much simpler than, say, modifying sitecustomize. I specifically wanted this to register new codecs, and, to some degree, it is used for that. The Korean codecs package ships a PTH file that says import korean.aliases korean/aliases.py starts with import encodings.aliases encodings.aliases.aliases.update({ 'cp949': 'korean.cp949', 'ms949': 'korean.cp949', 'uhc': 'korean.cp949', 'euc_kr': 'korean.euc_kr', ... Adding new codecs or new aliases is very similar to adding new items to sys.path. I guess you can also use it to register new importers, if Just's future PEP is accepted. Regards, Martin
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