homepage

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.

Author serhiy.storchaka
Recipients Arfrever, alex, barry, brett.cannon, docs@python, eric.snow, ethan.furman, mark.dickinson, mjacob, ncoghlan, python-dev, rhettinger, serhiy.storchaka, vstinner
Date 2021年08月31日.10:27:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630405625.47.0.942758627213.issue17576@roundup.psfhosted.org>
In-reply-to
Content
PyNumber_Index() now always returns an instance of int.
- If the argument is a direct int then return it.
- If it is a subclass of int then return a direct int copy.
- Otherwise call type(obj).__index__(obj)
- If a direct int, return it
- If a subclass of int, raise a DeprecationWarning and return a direct int copy
- If not an int, raise TypeError
If we go in this direction we should add a DeprecationWarning for __str__() returning not direct str. I am not sure that it is right. It adds a burden on authors of special methods to always convert the result to the corresponding direct type, while this conversion can silently (and more efficiently) be performed in the interpreter core.
History
Date User Action Args
2021年08月31日 10:27:05serhiy.storchakasetrecipients: + serhiy.storchaka, barry, brett.cannon, rhettinger, mark.dickinson, ncoghlan, vstinner, Arfrever, alex, docs@python, ethan.furman, python-dev, eric.snow, mjacob
2021年08月31日 10:27:05serhiy.storchakasetmessageid: <1630405625.47.0.942758627213.issue17576@roundup.psfhosted.org>
2021年08月31日 10:27:05serhiy.storchakalinkissue17576 messages
2021年08月31日 10:27:05serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /