This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <1459933312.1.0.479151701513.issue26701@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-04-06 09:01:52robert_smallshiresetrecipients: + robert_smallshire, docs@python
2016-04-06 09:01:52robert_smallshiresetmessageid: <1459933312.1.0.479151701513.issue26701@psf.upfronthosting.co.za>
2016-04-06 09:01:52robert_smallshirelinkissue26701 messages
2016-04-06 09:01:51robert_smallshirecreate