Changes by Byron Ruth :
--
components: Library (Lib)
nosy: bruth
priority: normal
severity: normal
status: open
title: collections.Iterator __subclasshook__ does not check if next() is
callable
type: behavior
versions: Python 2.7
___
Python tracker
New submission from Byron Ruth:
Consider:
```python
class A(object):
def __init__(self):
self.r = iter(range(5))
def __iter__(self):
return self
@property
def next(self):
return next(self.r)
```
The `next` method is a property, however:
```python
from
Byron Ruth added the comment:
Understood. I am not sure it is appropriate to follow-up with a question here,
but would this be a downstream issue? My understanding of the iterator protocol
is that is assumes the __iter__ and next methods are implements. In the
example, the next method is
Byron Ruth added the comment:
Thank you for the education. I didn't think about duck-typing extending to the
level of whether or not something is callable.. then again the property _could_
return a callable and it would be transparent to the c