"list index out of range" error
sam
python.sam at googlemail.com
Wed Sep 20 19:26:08 EDT 2006
gabriel,
> Now that your main problem is gone, just a few comments:
> - python lists know their length, so you don't need explicit no_lines
> and no_lines_2
> - list_initial.remove(temp_str) is fairly slow - it has to *scan* the
> list to locate temp_str. Just keep its index instead, and use del
> list_initial[index]
i will try rewriting it in that manner and comparing the times. i have
no feel so far for the relative speeds of different ways of doing
things, but i can see the importance of it.
> - as a general sorting routine, that 'zzz....' does not look very
> good, try to avoid it.
yes, it's hideous even to a novice. however, i need to go to bed now,
and if i hadn't got this to work before bed, i'd never get to sleep!
i'll have to mull it over and come up with something more elegant.
ben,
i used to work for a company where we exchanged a lot of e-mails, and
the titles were always 're: your e-mail', or 'project stuff', or 'file
for client' or suchlike. made it kind of difficult to find anything.
figured a similar principle might apply here... ; )
thanks again all,
sam
More information about the Python-list
mailing list