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.

作者 mark.dickinson
收信人 mark.dickinson, meador.inge, skrah
日期 2011-09-16.11:59:06
SpamBayes Score 0.0037592305
Marked as misclassified
Message-id <1316174347.72.0.567410783453.issue12974@psf.upfronthosting.co.za>
In-reply-to
内容
Yes, that's intentional.  When use of __int__ was deprecated, a bug report popped up from someone who wanted to be able to have their own objects treated as integers for the purposes of struct.pack.  (I don't recall which issue;  Meador, do you remember?)  So we added use of __index__ at that point.

I think __index__ is the right interface for something to expose if it wants to be usable as an integer, and this usage is consistent with the original __index__ PEP.
历史
日期 用户 动作 参数
2011-09-16 11:59:07mark.dickinson修改recipients: + mark.dickinson, skrah, meador.inge
2011-09-16 11:59:07mark.dickinson修改messageid: <1316174347.72.0.567410783453.issue12974@psf.upfronthosting.co.za>
2011-09-16 11:59:07mark.dickinson链接issue12974 messages
2011-09-16 11:59:06mark.dickinson创建