Comment

Comment by thomasahle

> I expect them to come back with four distinct empty buckets. The intuitive interpretation of [[]]*4 is asking just that.

I think the small example is misguiding the intuition here.

If I write `my_list = f(expensive operation); long_list = my_list * 4`, I don't expect python to recreate the whole thing four times. I justly assume `f` will be evaluated once, and then copied.

parent thomasahle 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton