[Python-ideas] Break the dominance of boolean values in boolean context

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 13 01:55:30 CEST 2011


Eric Snow wrote:

> So you want "give me the item 'foo' in mycontainer"  rather than "is
> item 'foo' in mycontainer"?  Isn't that what __getitem__ does already?

The canonical use case for this kind of thing is numpy arrays.
To be consistent with the numpy philosophy, 'a in b' where b
is an array should give you an array of values indicating whether
a is in each element of b.

-- 
Greg



More information about the Python-ideas mailing list