Vedran Čačić added the comment:

Of course. The Deceptive class was just reductio ad absurdum. I'm all for 
believing the class through what attributes does it expose. We agree there.

Where we don't agree, is _what_ attributes constitute the iteration protocol. 
You, the source code and the documentation of the collections.abc.Iterable say 
one thing (__iter__), while I, the current version of Python (at least CPython, 
but I think other implementations do the same) and the glossary say another 
thing (__iter__ or __getitem__).

[It's not the only protocol consisting of two attributes... e.g. bool protocol 
also consists of two attributes, __bool__ and __len__ (though it is not 
optional, so we don't have collections.abc.Boolable).]

You seem to say that only the glossary needs fixing. But then we'll be in an 
even more weird position, where we must say some objects can be iterated, but 
are not iterables. I'm pretty sure you don't want that. The whole point of 
"Xable" words (e.g. "callable", as opposed to "function") is that it 
encompasses everything that can be Xed, not only the first thing that comes to 
mind (e.g. classes can also be called).

Or are you saying that after the glossary is fixed, then we should fix Python 
by (at least deprecating, if not) forbidding __getitem__ iteration? I'm not 
sure that this is the consensus. Are you?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18558>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to