Is list::copy specific only for some types? #89
Unanswered
ales-tsurko
asked this question in
Q&A
Replies: 1 comment
-
Hi @ales-tsurko 👋 Good point, I think that's surprising behaviour and I'd also expect copies of the iterator to be made with My feeling is that generally iterators shouldn't need a special operation to make a copy, they should just be copyable by default. e.g. x = (1..100).iter()
y = x
x.next() # 1
y.next() # 2 - I would expect 1 here
x.next() # 3
z = x
x.next() # 4
z.next() # 5 - I would expect 4 here I can't think of a reason to keep the current behaviour of shared state between copies. I'll create an issue to look into it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've found that
copy
anddeep_copy
of list doesn't work if item is iterator:Also, is there a way to copy an iterator directly?
Beta Was this translation helpful? Give feedback.
All reactions