En Fri, 09 Mar 2007 17:43:53 -0300, Carsten Haese <[EMAIL PROTECTED]>  
escribió:

>> class warfare:
>>     def __init__(self): self.pairs = [[0,0]]*2
>>     def __str__(self): return str(self.pairs)
>>     def setfirst (self,i,value): self.pairs[i][0] = value
>>     def setsecond(self,i,value): self.pairs[i][1] = value
>
> http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list

Also see this more general topic:
http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to