Help With Python

Steven Bethard steven.bethard at gmail.com
Thu Jan 27 13:06:18 EST 2005


Nick Craig-Wood wrote:
> Steven Bethard <steven.bethard at gmail.com> wrote:
>> py> orders = [Viking().order()] * 7
>> py> ', '.join(orders)
>> 'Spam, Spam, Spam, Spam, Spam, Spam, Spam'
> 
> Thats still one Viking making 7 orders surely?
>
> So you want this...
> 
>>>>orders = [ Viking().order() for _ in range(7) ]

Right, right.  Thanks for the correction!  This is why I never use the * 
operator on lists. ;)

Steve



More information about the Python-list mailing list