[docs] [issue21611] int() docstring - unclear what number is

Dmitry Andreychuk report at bugs.python.org
Mon Jun 2 08:49:06 CEST 2014


Dmitry Andreychuk added the comment:

Now I see that my message may look like a suggestion to add an encyclopedic definition of number there. Sorry.

Actually I was talking about requirements for user-defined types to make them work with int(). Something like: "If x has __int__() method return x.__int__(). Else x must be a string, bytes, or bytearray...".

After reading the docstring I was like: Should I just define __int__() for my class to work with int() or maybe int() uses isintance() and my class has also to inherit from numbers.Number?

But maybe It's just me and it's clear for everyone else.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21611>
_______________________________________


More information about the docs mailing list