Status of PEP's?
eppstein at ics.uci.edu
Thu Mar 7 18:26:34 CET 2002
In article <mailman.1015518734.6414.python-list at python.org>,
"Bjorn Pettersen" <BPettersen at NAREX.com> wrote:
> This surely doesn't have to be true. The for loop implicitly calls
> iter(seq) to get an iterator, and the if statement first tries to call
> contains when faced with an 'in' test. It's trivial to implement a
> contains method for type int that preserves the orthogonality.
> You're right though that the PEP should probably say whether it also
> proposes to implement contains for type int.
It doesn't have to -- x in y will fall back on __iter__ if it doesn't
find a contains, won't it? Of course implementing a matching contains
method would be more efficient, if we wanted to actually encourage x in
More information about the Python-list