[Tutor] for loop problems

Magnus Lycka magnus@thinkware.se
Mon Nov 4 13:57:07 2002


At 11:15 2002-11-04 -0500, Chris Davidson wrote:
>            endingMark.join(element)

Oops. You are throwing away the result of your
join operation! That seems like a fairly point-
less operation. You should do something like

endinMarkJoinedElements = endingMark.join(element)

(You are allowed to use a slightly shorter variable
name of course.)

The x.join(y) doesn't modify x or y. It's an expression,
it returns a result, and can be used like:

s = x.join(y) or
f(x.join(y)) or
l.append(x.join(y)) but
x.join(y) by itself seems meaningless.


-- 
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