Sequence-spreading

Remco Gerlich scarblac at pino.selwerd.nl
Tue Mar 20 14:58:44 EST 2001


gzeljko <gzeljko at sezampro.yu> wrote in comp.lang.python:
> 
> Alex Martelli <aleaxit at yahoo.com> wrote in message
> > offsets = [ [] for i in range(pm) ]
> > for i in range(len(arg)):
> >     offsets[i%pm].append(i)
> 
> Old syntax yet works:
> 
> offsets = [[]]*pm

>>> offsets = [[]]*2
>>> offsets[0].append(1)
>>> offsets
[[1], [1]]

oops

-- 
Remco Gerlich



More information about the Python-list mailing list