no side effects
mwm at mired.org
Thu Jan 9 01:34:31 CET 2003
Nagy László <nagylzs at freemail.hu> writes:
> Another explanation for a newbie would be this.
> When comparing C++ (or other similar language) and Python for loop,
> the first thing I would mention is that in C++, a for loop is
> terminated by a condition
> but in Python, there is no condition anyway.
Yes there is a condition. It's the end of the list. You can influence
that to get side effects:
l = [1, 2, 3]
for i in l:
will just print "1".
That said, I have *no* idea whether or not this behavior can be
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list