STINNER Victor <vstin...@redhat.com> added the comment:

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...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36048>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to