-
Notifications
You must be signed in to change notification settings - Fork 333
Description
Thank you for itertools!
It's my fault for not reading the documentation for put_back
, but I accidentally wrote a bug by putting two items back into an iterator and overwriting the old one.
I might be wrong, but this behavior seems a bit error prone, and might be unexpected.
I would consider renaming PutBack
to PutBackOne
, and PutBackN
to PutBack
. Unless the overwriting behavior is desirable, PutBack
is essentially a speed/memory optimization when compared to PutBackN
, so I would guide users to what is currently PutBackN
, and they can then switch to what is currently PutBack
as an optimization.
If the overwriting behavior is never desirable, it might be good to make it panic on the second call to put_back
in a row. In my case, this would have saved me a bit of debugging time.