question about the id()

Peter Dembinski pdemb at gazeta.pl
Tue May 17 07:56:18 EDT 2005


"Giovanni Bajo" <noway at sorry.com> writes:

> Peter Dembinski wrote:
>
>>> BTW, a typical performance optimization (not done automatically by
>>> python) is to hoist unchanging-value expressions out of loops, and
>>> obj.method is often such an expression, so you will this strategy
>>> when people try
>>> to squeeze extra performance from their programs.
>>
>> Good to know.  Is there any advanced optimizer for Python code,
>> which would do such things for me (or suggest them, like pychecker
>> does for readability)?
>
>
> Prove that a.f() would not change the meaning of "a.f" after its
> invokation is close to impossible.

Many things in Python programs cannot be proved.  But what about
suggesting optimisations, not doing them automatically?  

The similar case may be found in refactorization -- most things cannot
be proved, so the final decision is left to the programmer (and his
unit tests).

-- 
http://www.peter.dembinski.prv.pl



More information about the Python-list mailing list