Author John Belmonte
Recipients John Belmonte, Manjusaka, ethan.furman, veky
Date 2020-10-11.21:26:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602451582.36.0.26779419543.issue38250@roundup.psfhosted.org>
In-reply-to
Content
> Just a comment, (1) is analogous to str. iter('abc') gives only 'a', 'b' and 'c', while contains accepts '', 'ab', 'bc', and 'abc' too. At least in my mind, it's a pretty strong analogy.

I don't agree.  The "zero" bit does not exist, so having __contains__ return True on `Foo(0) in x` is misaligned with the iterator.  And having __contains__ return True for specific compound values just because they happen to be explicitly defined, while returning False for others, is arbitrary.  __contains__ seems to be of very little use, and moreover a trap for the unwary.  Assuming we have to live with that until Python 4, it's better to make an explicit iterator like `bits()` so that the API doesn't contradict itself.
History
Date User Action Args
2020-10-11 21:26:22John Belmontesetrecipients: + John Belmonte, ethan.furman, veky, Manjusaka
2020-10-11 21:26:22John Belmontesetmessageid: <1602451582.36.0.26779419543.issue38250@roundup.psfhosted.org>
2020-10-11 21:26:22John Belmontelinkissue38250 messages
2020-10-11 21:26:22John Belmontecreate