Replacement for locals() ???

Harald Massa cpl.19.ghum at spamgourmet.com
Sat Jul 31 05:41:25 EDT 2004


Terry,


>> So two of the greatest PythonBrains have problems in optimizing
>> Python because of locals(), the most common usage of Python in my
>> practice is peripheral; so just by way of precaution I am looking for
>> a 
>>r eplacement.
> 
> I suspect you are very prematurely optimizing.  Since you are filling
> out SQL statements, I would expect that your bottlenecks are and will
> be the execution of the statements, and not the construction of the
> statements. 

you are partially right. I do not have ANY performance problems in that
Python code. Most of the time the program is either waiting for a
COM-Server, a database-Server or user-typing. 

As Skip stated: using locals() prevents the EASY use of psyco.  
(import psyco; psyco full
Forcing me to manually bind psyco to functions ... etc.

also in standard lib "encodings" locals() is used. 

I know there may be some exotic usages of locals(), but most use is
really straightforward string substitution & parameterparsing; and
thatfor I am asking: "How can I make it easy to psyco / ironpython /
PyPy???/ parrot to optimize my code" ... 

Best wishes,

Harald




More information about the Python-list mailing list