Author robert_smallshire
Recipients docs@python, robert_smallshire
Date 2016-04-06.09:01:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The documentation for the int(x) constructor explains that if possible, it delegates to x.__int__().   The documentation does not explain that there is a fallback to x.__trunc__() if x.__int__() is not available.

The only mention of __trunc__ in the Python documentation is in the entry for math.trunc; the documentation for the numbers module does not describe the underlying special methods.

Given that all Real numbers are required to implement __trunc__ but only Integral subclasses are required to implement __int__ this could be important to implementers of other Real types, although in practice I imagine that most Real types will implement __int__ as float does.
Date User Action Args
2016-04-06 09:01:52robert_smallshiresetrecipients: + robert_smallshire, docs@python
2016-04-06 09:01:52robert_smallshiresetmessageid: <>
2016-04-06 09:01:52robert_smallshirelinkissue26701 messages
2016-04-06 09:01:51robert_smallshirecreate