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

Dmitry Andreychuk report at bugs.python.org
Fri May 30 10:58:56 CEST 2014


New submission from Dmitry Andreychuk:

https://docs.python.org/3.4/library/functions.html?highlight=int#int

The docstring for int() function has these sentences:
"If x is a number, return x.__int__()."
"If x is not a number or if base is given..."

Unfortunately the docstring doesn't describe how the function decides if x is a number or not.

After searching and experimenting I came to conclusion that it is the presence of x.__int__() method makes int() treat x as a number. But I'm not sure it's a precise requirement or just something that happens to work with current implementation.

I think there should be a precise definition of what is considered to be a number there.

----------
assignee: docs at python
components: Documentation
messages: 219379
nosy: and, docs at python
priority: normal
severity: normal
status: open
title: int() docstring - unclear what number is
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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


More information about the docs mailing list