Message 336069 - Python tracker
I like the idea. Rejecting float but not decimal.Decimal is inconsistent. __index__ has been written explicitly for this purpose. I'm always confused and lost in subtle details of the Python and C API in how they handle numbers, so I wrote some notes for myself: https://pythondev.readthedocs.io/numbers.html Some functions accept only int, others use __int__, others __index__. Some functions silently truncate into 32 or 64-bit signed integer. Some other raise a OverflowError or ValueError...