Message400707
| 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:05 | serhiy.storchaka | set | recipients: + 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:05 | serhiy.storchaka | set | messageid: <1630405625.47.0.942758627213.issue17576@roundup.psfhosted.org> |
| 2021-08-31 10:27:05 | serhiy.storchaka | link | issue17576 messages |
| 2021-08-31 10:27:05 | serhiy.storchaka | create | |