Efficient python programming...
eddie at holyrood.ed.ac.uk
Fri Jun 7 07:06:51 EDT 2002
"Shagshag13" <shagshag13 at yahoo.fr> writes:
> I'm looking for any state of art, optimizing techniques, tips, that a
>python beginner couldn't know by itself, but should learn and
>would be aware to write "efficient and good looking"python's code...
> (not the kind of thing which made you an obfuscated python nerd,
>but that "map" should be preferred to "for in loop" if possible, that
>dictionary are very well optimized, etc.)
A friend is fond of quoting this to me:
Rules of Optimization:
Rule 1: Don't do it.
Rule 2 (for experts only): Don't do it yet.
-- M.A. Jackson
I wasn't going to bother contributing since others have said the same thing
but the more people say the more you'll believe it :)
Especially for a beginner the important thing is to get clear and obvious
code. Later, IF IT ISN'T FAST ENOUGH, then you think about ways to speed it
There are may reasons for this, one of them is that it is often counter
intuitive exactly what the fastest approach is anyway.
Just concentrate on finding sensible algorithms as you would in any other
More information about the Python-list