Python IS slow ! [was] Re: Python too slow for real world

Christian Tismer tismer at appliedbiometrics.com
Fri Apr 30 09:02:43 EDT 1999


Randall Hopper wrote:
> 
> Christian Tismer:
>  |Terry Reedy wrote:
>  |> A batch-mode optimizer analyzing an entire file (module) should be able to
>  |> detect whether or not function names are rebound.
>  |>
>  |> Perhaps module bindings should be considered immutable from outside the
>  |> module unless explicitly declared otherwise.
>  |
>  |I'm thinking of no new keyword, but a mechanism which allows me to lock a
>  |namespace somehow.
> 
> I like this idea in concept.  Though I would prefer a way to have
> namespaces "lock by default".  Examples:  After a class definition, the
> class function dictionary is locked.  After a module is fully read, all
> references are bound and the module namespace is locked.  etc.

Well, I wouldn't do that by default. By default, everything 
could stay as it is. First of all, this would not break any
existing code. Then, many people will want to
fine tune their modules, and they are perhaps not done
after a class definition was ready.

Then, what would you do with classes which depend on each 
other? You cannot lock them immediately, this would fail.
Locking them after they both are defined is fine, since
everything is defined then. With minimum effort and no
language changes, this will be needed.

Then think of all the more difficult systems which need
more effort to become configured. The xml parsers together
with SAX are an example. If I wanted to lock this, then
this must be done with care. One would also not lock the mixin
classes, but only the final workhorse class, bound with
the correctly selected parser, and so on.

It might also be necessary to find a way to specify which
attributes may be locked and which not, since there exist
indeed cases where Python's super-flexibility is needed :-)

Depending on how exactly will be implemented, a single line
at the end of a module should suffice to accomplish this stuff
for the standard cases. Fine adjustment would take a little more.
As a side effect, locking a module would also find all 
referenced but undefined symbols.

Anyway, this is still no cakewalk and quite a lot of code
is involved. Needs much more thinking...

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