[Python-ideas] __iter__ implies __contains__?

Victor Stinner victor.stinner at haypocalc.com
Sun Oct 2 13:59:36 CEST 2011


Le dimanche 2 octobre 2011 07:13:29, Raymond Hettinger a écrit :
> The decision to make __contains__ work whenever __iter__ is defined
> probably goes back to Py2.2.   That seems to have worked out well
> for most users, so I don't see a reason to change that now.

It is surprising in StringIO, so it should be fixed in IOBase, but no in 
Python.

Victor



More information about the Python-ideas mailing list