List Behavior when inserting new items
Drew
olsonas at gmail.com
Mon Jan 29 16:13:12 EST 2007
> > Is there any way to produce this kind of behavior easily?Hints:
> >>> [None] * 5
> [None, None, None, None, None]
> >>> [1, 2, 3, None] + [10]
> [1, 2, 3, None, 10]
>
> HTH
That is exactly what I was looking for. I'm actually working on some
problems at http://codgolf.com. I find it helps me to learn a language
and I'm coming from ruby where arrays have subtle differences from
python's lists. Thanks for all the helpful responses.
More information about the Python-list
mailing list