python loops

Fredrik Lundh fredrik at pythonware.com
Sun Sep 3 04:44:11 EDT 2006


Nicko wrote:

> There's a huge difference between not being profligate with resources
> and premature optimisation. In the case of the idiom "for i in
> range(x):..." there absolutely no utility whatsoever in creating and
> recording the list of objects. Unless it makes a difference to code
> structure or maintainability, I think that not creating stacks of
> objects you don't need is basic code hygiene and not freakish premature
> optimisation.

for short lists, both objects create the *same* number of objects.

if you cannot refrain from pulling arguments out of your ass, you not 
really the right person to talk about hygiene.

</F>




More information about the Python-list mailing list