[Tutor] file-like object
Terry Carroll
carroll at tjc.com
Fri Jan 14 18:46:15 CET 2005
On Fri, 14 Jan 2005, Chad Crabtree wrote:
> class _macroString(object):
> def __init__(self,s):
> self.macro=s
> self.list=self.macro.split("\n")
> for n,v in enumerate(self.list):
> self.list[n]=v+'\n'
Is this for loop a safe technique, where the list you're enumerating over
in the for statement is the same as the one being updated in the loop
body? I always avoid things like that.
More information about the Tutor
mailing list