This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 barry
收信人 alex, barry, docs@python, eric.snow
日期 2013-03-30.00:39:42
SpamBayes Score -1.0
Marked as misclassified
Message-id <20130329203938.6a53389b@limelight.wooz.org>
In-reply-to <1364603376.41.0.418321948666.issue17576@psf.upfronthosting.co.za>
内容
On Mar 30, 2013, at 12:29 AM, Eric Snow wrote:

>Would it be okay to do a check on __index__ after the PyLong_Check()
>succeeds?  Something like this:
>
>    if (PyLong_Check(item) &&
>        item->ob_type->tp_as_number->nb_index == PyLong_Type.tp_as_number->nb_index) {
>        Py_INCREF(item);
>        return item;
>    }
>
>This is something Nick and I were talking about at the sprints regarding fast
>paths in the abstract API (for mappings and sequences in our case).

I think that would work, yes.  With this extra check, overriding __index__()
in the subclass should fail this condition and fall back to the
PyIndex_Check() clause.
历史
日期 用户 动作 参数
2013-03-30 00:39:42barry修改recipients: + barry, alex, docs@python, eric.snow
2013-03-30 00:39:42barry链接issue17576 messages
2013-03-30 00:39:42barry创建