[Python-ideas] Non-boolean return from __contains__

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Jul 26 16:54:24 CEST 2010

On Mon, Jul 26, 2010 at 10:28 AM, Guido van Rossum <guido at python.org> wrote:
> Well, the point of allowing more general __contains__ overloading is
> exactly to improve upon the query syntax -- you may call it syntactic
> sugar (often a derogatory term), but you currently cannot translate an
> 'in' operator into a parse tree like you can for '<' or '+'.

FWIW, I am +0 on a more general __contains__  and query or expression
building are the areas where I could use it.

Since we are at it, can we have a decision on  whether mp_length and
sq_length will change their signatures to return PyObject* rather than
Py_ssize_t.   In other words, are we going to allow virtual sequences
like py3k range to have length greater than sys.maxsize?  There is an
old open issue that turns on this decision:


Here I am -1 on making the change but +1 on the range patch in the issue.

More information about the Python-ideas mailing list