[Python-checkins] r75028 - in python/branches/py3k: Doc/library/functions.rst Lib/test/test_range.py Misc/NEWS Objects/rangeobject.c

Mark Dickinson dickinsm at gmail.com
Thu Sep 24 21:41:40 CEST 2009


On Wed, Sep 23, 2009 at 2:14 PM, Georg Brandl <g.brandl at gmx.net> wrote:
> Mark Dickinson schrieb:
[...]
>> More to the point, would it be acceptable for
>>
>> x in range(0, 10, 2)
>>
>> and
>>
>> x in list(range(0, 10, 2))
>>
>> to return different results?
>
> IMO, that should not be acceptable.  We cannot prevent __contains__
> for user-defined types from doing something different from comparing to
> the items that are yielded when the object is iterated over, but core
> types should not introduce such confusing behavior.

To be really safe, I guess that PyLong_Check should really be
a PyLong_CheckExact.  I'll fix it.

Mark


More information about the Python-checkins mailing list