Message262941
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:52 | robert_smallshire | set | recipients:
+ robert_smallshire, docs@python |
2016-04-06 09:01:52 | robert_smallshire | set | messageid: <1459933312.1.0.479151701513.issue26701@psf.upfronthosting.co.za> |
2016-04-06 09:01:52 | robert_smallshire | link | issue26701 messages |
2016-04-06 09:01:51 | robert_smallshire | create | |
|