On Aug 12, 2012 12:56 PM, "PJ Eby" <pje at telecommunity.com> wrote: > I'm not sure if this is directly related or not, but making this > mechanism support custom compilation for new filename suffixes would > be nice, especially for various e.g. HTML/XML templating systems that > compile to Python or bytecode. > > Specifically, having a way to add a new source suffix (e.g. ".kid", > ".zpt", etc.) and a matching compilation function, such that it's > automatically picked up for compilation by both the filesystem and zip > importers would be awesome. It'd also allow for DSLs and syntax > experiments using alternative filename extensions. +1 I'm hacking around this right now for a project I'm working on. I definitely do this through the import system. Inserting a look-alike path hook and monkeypatching the cached path entry finders is not difficult, but certainly fragile and less than ideal. Consequently I've been looking into simple and not-so-simple solutions to making it easier to add new suffixes to be handled. The source/pyc-to-code-to-module path during imports is so prevalent and critical that it may benefit from its own model. This is similar to how the path-based import subsystem has its own special-case model. Or source-based imports just need better special-casing in the path-based import subsystem. Perhaps just adding and using sys.source_suffixes as a mapping of suffixes to loader classes. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120812/8f33887c/attachment.html>
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