Author martin.panter
Recipients belopolsky, docs@python, georg.brandl, mark.dickinson, martin.panter, mdk
Date 2016-03-11.23:52:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1457740320.93.0.421157375697.issue26512@psf.upfronthosting.co.za>
In-reply-to
Content
I have looked at PEP 3141, the history of the documentation in question, and the documentation of the functions in the “math” module. It seems that trunc(), floor() and ceil() were all intended to return a numbers.Integral type, but then PEP 3141’s floor() and ceil() were reverted from Python 2 due to compatibility concerns, where they only accept and return float objects. So it would be correct to clarify that Integral means numbers.Integral.

The term “integral float” was added by revision 94eeaeeb3ce9, to mean a Python float() object that represents an integer. This is correct (but hard to understand) for Python 2, but the change is not appropriate for Python 3, where floor() and ceil() follow PEP 3141 instead and do return integers (numbers.Integral).

I propose to just point to the proper math.trunc(), round() etc documentation and remove the table (originally added in revision 4f9723d9ca32). Julien: do you think the definitions in <https://docs.python.org/3.5/library/math.html#number-theoretic-and-representation-functions> are understandable?

Also I noticed Python 3’s floor() and ceil() doc strings say int not numbers.Integral. That should probably also be fixed.

Julien, if you agree with my suggestion, do you still want to do a patch for this? Otherwise, I could have a go when I get a chance.
History
Date User Action Args
2016-03-11 23:52:00martin.pantersetrecipients: + martin.panter, georg.brandl, mark.dickinson, belopolsky, docs@python, mdk
2016-03-11 23:52:00martin.pantersetmessageid: <1457740320.93.0.421157375697.issue26512@psf.upfronthosting.co.za>
2016-03-11 23:52:00martin.panterlinkissue26512 messages
2016-03-11 23:52:00martin.pantercreate