> What about using sys.path_hooks to run 2to3 on the fly at import time?
> It would cache its results, of course.

It would have to do so selectively, and it would be fairly slow (atleast
with the current implementation), but yes, that could also work.

The question then is: what __file__ do you put into the code? The
original one, or the cached one? I'd vote for the cached copy, so
that you get sensible output in tracebacks. It probably should
also mark the cached copy read-only on disk, so that people won't
attempt to edit it. If off-by-one errors are acceptable, it could
also try to put a first-line comment "GENERATED" into it.

Regards,
Martin

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to