Author erlendaasland
Recipients berker.peksag, erlendaasland, serhiy.storchaka
Date 2021-02-19.19:59:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> It is a kind of optimization.

PyLong_Check is very fast (only one comparison, AFAICS), so there is no gain in first doing PyLong_CheckExact and then PyLong_Check. Ditto for unicode.

PyFloat_Check is the most expensive check, but it comes before both PyUnicode_Check and PyObject_CheckBuffer (both a lot faster), so that's AFAICS the opposite of an optimisation. Correct me if I'm wrong.

If we want to optimise it we should do PyLong_Check, PyUnicode_Check, PyObject_CheckBuffer, and then PyFloat_Check, no?

> there is nothing wrong in it.

True. I'll argue that my suggestion will improve readability and maintainability, which should be worth considering.
Date User Action Args
2021-02-19 19:59:37erlendaaslandsetrecipients: + erlendaasland, berker.peksag, serhiy.storchaka
2021-02-19 19:59:37erlendaaslandsetmessageid: <>
2021-02-19 19:59:37erlendaaslandlinkissue43267 messages
2021-02-19 19:59:37erlendaaslandcreate