[Tutor] Fastest way to iterate through a file

Reed O'Brien reed at reedobrien.com
Mon Jul 2 06:58:13 CEST 2007


On Jul 1, 2007, at 7:13 PM, elis aeris wrote:
>
>  might just end my quest for
> optimized python source code.
> ugh,
>
> what does it mean ?


elias,

We have two MAJOR rules regarding optimization.  These rules really  
go beyond python, but this is a good place to learn them.

The two rules of optimization:

The first is:
1) DON'T DO IT!

The second is only for advanced programmers.
2) Don't do it, yet!


Until you have working code, there is nothing to optimize. You can  
spend months optimizing and refactoring a for loop only to find out  
that you are hung up on a network operation.  Write the program  
first. Then see if it needs tweaking. other wise you are simply  
rewriting this:

for None in None:
     pass

~ro



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070702/1bf6cc47/attachment.html 


More information about the Tutor mailing list