Author veky
Recipients Zero, docs@python, r.david.murray, terry.reedy, veky
Date 2017-07-17.08:19:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think this is backwards. "Refusing the temptation to guess" in this case can mean returning True for is_iterable. After all, we can always have something like

    class Deceptive:
        def __iter__(self):
            raise TypeError("I'm not really iterable")

and it's not the business of instancecheck to actually iterate (either via __iter__, or __getitem__). Its task is to check whether it has a corresponding attribute (not set to None, per the new convention of explicitly disabling protocols).

It could be different if the "old __getitem__ iteration" was deprecated, or at least scheduled to be deprecated, but as far as I can tell, it isn't. (It really should be documented if it were so.)

_At least_, the documentation of should be more precise in saying (instead of just "See also the definition of iterable.") something like "Note that the definition of iterable in the glossary is more general than what this method checks, by design / omission / backward compatibility / apathy / whatever."

(Ok, the last part might be too much. But it's essential to point out the things are different, and whether it's meant to stay that way.)
Date User Action Args
2017-07-17 08:19:55vekysetrecipients: + veky, terry.reedy, r.david.murray, Zero, docs@python
2017-07-17 08:19:55vekysetmessageid: <>
2017-07-17 08:19:55vekylinkissue18558 messages
2017-07-17 08:19:55vekycreate