Overhead for local assignments (was: A better self)

Louis M. Pecora pecora at anvil.nrl.navy.mil
Tue Jul 23 15:29:08 EDT 2002


In article <mailman.1027449754.19832.python-list at python.org>, Kerim
Borchaev <warkid at storm.ru> wrote:

> It feels like a general advice.
> "lots of class function" - it lets everyone decide the meaning of
> "lots" for himself; or how should I treat "to just calculate a
> formula" - is it for any code that involves "the math"?

Yes, but it's for assigning local variables to avoid using self. 
That's it. If you have other ways you might do it, please test those
and post the results.  

> So I'd give another general advice:
> 
> - Make the code as clean as possible(using functions, methods - all
>   the best of the language ) BEFORE you discover that it works too slow.
>    
> - And only whan you're absolutely sure(the tests show) that
>   it's slow for your needs - think about optimization.
>   
> - Then profile test cases of interest to find out which pieces of code are
>   worth optimizing to get a valuable speedup.
> 
> - Then optimize. ...or not yet?
> 
> Best regards,
>  Kerim                            mailto:warkid at storm.ru

All good advice, but I don't have the time to do all that.  It was
meant to be a quick test in response to some suggestions on the "Best
self." thread that some of the code people were suggesting should be
tried out.  Some other quick tests by others appear on that thread.  I
think what I got was informative since I've seen code and suggestions
just like what I offered.  You may disagree.  Maybe I should put
disclaimers in it.  Well, live and learn.

Thanks.

-- 
Lou Pecora
  - My views are my own.



More information about the Python-list mailing list