Bytecode optimisation
Christian Tismer
tismer at appliedbiometrics.com
Tue May 18 20:33:25 EDT 1999
"M.-A. Lemburg" wrote:
...
> About adding type information to variables:
>
> Wouldn't it be possible to make the optimizer recognize
> the following type of assert statement and then use the
> implicit information contained in it...
>
> assert type(x) is types.IntegerType
> x = x + 2
>
> There are many advantages to this construct, since it can
> be used to debug *and* optimize code. It also is perfectly
> valid Python and shows the programmers intent pretty well,
> IMHO.
Sounds fine, although it doesn't give you a guarantee,
just a hint. Faulty code could change x' type again
somewhere, so either a flow analysis is needed, or
the code must still be aware of any type, and can just
optimize towards the promised one.
ciao - chris
--
Christian Tismer :^) <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home
More information about the Python-list
mailing list