Eric Hagemann ehagemann at home.com
Wed May 10 03:24:58 CEST 2000

Anybody know of work done along the lines of optimizing Python code ? Has
anybody done benchmarks on different coding styles ? Examples of questions

Is it faster to split a string into a tuple with individual elements

>>> a= "as the end"
>>>(x,y,z) = string.split(a," ")
where x = 'as', y = 'the' and z='end'

or as a list

>>>q = string.split(a," " )
where following accesses would entail q[0]='as' etc.

Is is faster to index through a list


>>>for i in range(4):
>>>   a[i].....


>>>for x in a:
>>>    .......

The answer (as I have found) out is the second.  I am not looking for
specific answers about these questions but they represent the type of
information I seek.  I am looking in general to produce quick code and am
looking for coding techniques that are best utilize the language.


More information about the Python-list mailing list