[Tutor] making proigress

Magnus Lycka magnus@thinkware.se
Tue Dec 17 06:23:01 2002


At 01:01 2002-12-17 -0500, Kirk Bailey wrote:
>Advice? this is python 1.5.2, is this important?

Yes, it makes all the difference.

Do you really HAVE to work with that old version?

String methods came in 1.6 or 2.0, don't remember
which, and it makes little difference because you
should never use 1.6.x, it's buggy.

Basically, for 1.5.2 or prior, change all

"a string".some_method(a, b, c)

to

import string
...
string.some_method("a string", a, b, c)

Obviously, you use the old style a few lines above, in:
                 aliasline=string.strip(f1.readline())   #
That's kocher in 1.5.2, but in modern python it would be
written as
                 aliasline=f1.readline().strip()

To be 1.5.2 complient, you must be consistent with this and
do:
                if string.find(aliasline, listname+':/"')==-1:  # if this is
instead of
                if aliasline.find(listname+':/"')==-1:  # if this is

BTW, you seem to have indentation problems with your code,
mixing tabs and spaces. I suggest that you always run your
programs with "python -tt" to root out such evil.



-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se