Python IS slow ! [was] Re: Python too slow for real world
Randall Hopper
aa8vb at vislab.epa.gov
Fri Apr 30 10:12:15 EDT 1999
Christian Tismer:
|Randall Hopper wrote:
|> Christian Tismer:
|> |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.
Right. I wasn't too clear. By default, I mean I don't want to have to
insert some commands/declarations for every namespace (every class, every
method, every module, etc.) to lock them. I want this to happen
automagically based on a switch.
A command-line option (-w), or something like Perl's "use strict"
declaration would be a reasonable way to enable this behavior.
|Then, what would you do with classes which depend on each
|other? You cannot lock them immediately, this would fail.
Could you give an example?
|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.
This would prevent namespace binding and locking from occuring while the
module is being parsed, wouldn't it? With a lock declaration at the
beginning, Python could do this as it goes. Seems like that would be
easier (Python sees end of function -> module.symbol referenced in the
function was not defined -> flag error and abort parse).
|As a side effect, locking a module would also find all
|referenced but undefined symbols.
That's the goal I'm rooting for. ;-)
|Anyway, this is still no cakewalk and quite a lot of code
|is involved. Needs much more thinking...
Definitely. No doubt Guido and the other language experts have a better
feel for this than I do. But I felt compelled to chime-in on this topic
since it's important to me (and the squeaky wheel gets the grease. :-)
Randall
More information about the Python-list
mailing list