Backwards emulation rather than backwards compatibility?

John Roth johnroth at ameritech.net
Sat May 25 19:15:20 EDT 2002


"Martin v. Loewis" <martin at v.loewis.de> wrote in message
news:m3it5cp8hj.fsf at mira.informatik.hu-berlin.de...
> Antaeus Feldspar <feldspar at ix.netcom.com> writes:
>
> > Could the python interpreter be equipped with a mode that would
allow
> > it to emulate past interpreters?
>
> No, that won't be possible. It is easy enough to install multiple
> versions of the interpreter, though.
>
> Regards,
> Martin

Oh, come on now. Anything is possible, the question is
whether it is worth doing and (this being a volunteer effort)
whether anyone wants to do it.

Frankly, I think it's an excellent idea, although it would
have a cost.

To delimit the debate: either a specific statement at the
front of the module "Requires 2.1" or the code in the
compiled module indicates the language level needed.

Also, it should be possible to mix levels in one program,
the limitation being that any one module is interpreted
under one set of rules. No mixing is allowed within a
module - that way lies insanity for the next person who
has to deal with the resulting mess. It also means that
the interpreter does not have to do very much different
when compiling a module: if you want to compile a module
under a back level, Python automatically invoked the
appropriate level of the compiler, producing the
appropriate level of compiled module.

Frankly, I wouldn't think it would be that hard,
although I have absolutely no knowledge of the
internals of the python interpreter. Everything, after all,
is an object, so an int created under 2.0 would not
necessarilly have the same execution routines that an
int created under 2.3 would have.

Globals would have to be dealt with, and so would
imports from back level modules (it might be useful
to insure that they didn't import up level modules.)

John Roth
>





More information about the Python-list mailing list