![](https://secure.gravatar.com/avatar/a3f0c3b79723ee13714d444459b4a287.jpg?s=120&d=mm&r=g)
April 23, 2010
5:49 p.m.
On Fri, Apr 23, 2010 at 2:41 PM, David MacQuigg <macquigg@ece.arizona.edu> wrote:
Would you rather have Python do something different?
My own preference is that I would like 5*[[]] to be syntactic sugar for: [ [ ] for i in range(5)] I find this to be more intuitive, and I believe this is what most people incorrectly assume the syntax expands to. If that's the way it worked, literals would always create fresh copies each time through the loop, but if you still want shared behavior, you could do it explicitly with something like: x = [] a = 5*x Anyway, every language has its shares of gotchas. It's just this is one I've gotten burned by more than once.