dumb newbie list question

Dan Girellini drg at longhands.org
Fri Aug 24 02:24:26 CEST 2001

Yes this, basically what I was looking for.  Thanks for all the responses.  I
appreciate the help.


 -- "AD" == Andrew Dalke <dalke at acm.org> writes:

 AD> Dan Girellini:
 >>> Is there an easy way to do this without building a second list of the
 >>> right size and concatenating them?

 AD> Bernd Nawothnig:
 >> Why will you do this?
 >> l=l+(10-len(l))*['x']
 >> works fine and should be faster then many l.append('x')

 AD> If you don't want to create a new list, you could also do

 AD>   l.extend( [None] * (10-len(l)) )

 AD> (Using None is closer to the way Perl does it than using 'x'.)

More information about the Python-list mailing list