On 03/08/13 15:50, Albert-Jan Roskam wrote:
Suppose I initialize a list (letÅ› say it's a record) to e.g all zeroes,
> or all sixes. Suppose, further, that I use "*" for this
(which is a nice an clean way).
Its only nice if you use it at the top level with an immutable value, otherwise , as you can see, it quickly becomes not nice and not clean.
Use a list comprehension instead y = [[6] for i in range(4)] As the name suggests list comprehensions are designed for building lists. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor