[issue17584] collections.Iterator __subclasshook__ does not check if next() is callable

2013-03-30 Thread Byron Ruth
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

[issue17584] collections.Iterator __subclasshook__ does not check if next() is callable

2013-03-30 Thread Byron Ruth
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

[issue17584] collections.Iterator __subclasshook__ does not check if next() is callable

2013-03-30 Thread Byron Ruth
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

[issue17584] collections.Iterator __subclasshook__ does not check if next() is callable

2013-03-31 Thread Byron Ruth
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