On Sat, Aug 11, 2012 at 8:03 PM, Brett Cannon <br...@python.org> wrote:
>
> It would also be very easy to expand importlib.abc.SourceLoader to add a
> method which is called with source and returns the bytecode to be written
> out which people could override with AST optimizations before sending the
> bytecode back. That way we don't have to get into the whole business of AST
> transformations if we don't want to (although, as Victor pointed out, there
> are some people who do want this formally supported).

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.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to