Adding print-style function calls, and preproc plugins

Alex Martelli aleax at aleax.it
Thu Aug 30 03:43:00 EDT 2001


"Richard Jones" <richard at bizarsoftware.com.au> wrote in message
news:mailman.999153945.27627.python-list at python.org...
> On Thursday 30 August 2001 15:23, Gerson Kurz wrote:
> > 2) It would be nice if you could insert "preprocessor plugins" in the
> > python interpreter: python scripts, that preprocess the text before
> > interpreted. You can always add eval()/exec() statements to your code,
> > but it would be nice if they were to be added automatically. Then, a
> > syntax change like the one described in 1) could be easily added to
> > the interpreter for those who would like to have it. But, maybe thats
> > already possible and I only don't know of it ?
>
> I'm not sure it's exactly what you want, but have a look at the rexec
module
> in the standard library...

That has more to do with _execution_ (it helps you build a
sandbox for untrusted code) and very little to do with
syntax sugar.  Rather, I think that what you'd need to
satisfy Gerson's request is some kind of import-hook
magic -- but still, that would only work "blackmagically"
for stuff you IMPORT, not for the main script itself.

It *may* be possible to do something with sitecustomize.py
but I don't believe it gets called at the right time
for that to work.


Alex






More information about the Python-list mailing list