Closed xdmiodz closed 6 years ago
I believe you are right. I'm not sure how I originally came to the conclusion that iterators should be returned if detected, but that is different than the documented behaviour of iter
.
To make sure we're talking about the same issue, here's an example sequence of events as they should occur when only one argument is given to aiter
:
__aiter__
call it and return the value.__iter__
call it and return an async iterator wrapper.If you are interested in removing the check for __anext__
I would welcome the patch and ask that you bump the minor version and add one or two tests for aiter
. I should have some time soon to patch this as well.
Sure, will provide a patch soon
Hi,
It seems to me, that the method
aitertools.aiter
should ignore both__anext__
and__next__
methods inside of the passed iterable. I think it contradicts to the originaliter
's implementation and leads to inconsistencies .