[Python-ideas] Non-boolean return from contains (original) (raw)

Raymond Hettinger raymond.hettinger at gmail.com
Wed Jul 28 03:09:17 CEST 2010


On Jul 27, 2010, at 6:03 PM, Greg Ewing wrote:

Guido van Rossum wrote:

On Tue, Jul 27, 2010 at 3:29 PM, Mathias Panzenböck >

So it doesn't help that 'in' may return something else than a bool because the method is called on the wrong object for your purposes.

Well that pretty much kills the proposal. I can't believe nobody (including myself) figured this out earlier in the thread. :-( Alternatively, it could be taken as a sign that there is a special method missing -- there should be an in method that is tried on the first operand before trying contains on the second. (And if we'd thought of this at the beginning, contains would have been called rin. :-)

Don't forget not_in and not_rin ;-)

Raymond



More information about the Python-ideas mailing list