Reading the documentation

bob gailer bgailer at gmail.com
Thu Aug 24 19:41:46 EDT 2017


On 8/24/2017 3:24 PM, Stefan Ram wrote:
>    This is a transcript:
>
>>>> from math import floor
>>>> floor( "2.3" )
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> TypeError: must be real number, not str
>>>> help(floor)
> Help on built-in function floor in module math:
>
> floor(...)
>      floor(x)
>
>      Return the floor of x as an Integral.
>      This is the largest integer <= x.
>
>    Is the output of »help(floor)« supposed to be a kind of
>    normative documentation, i.e., /the/ authoritative
>    documentation of »floor«?
>
>    Is there any hint in the documentation about the type
>    expected of arguments in a call?
>
>    Is a parameter name »x« (as used above) described
>    somewhere to express the requirement of a real number?
>
>    It seems, »real« means »int or float«. Is this meaning
>    of »real« documented somewhere?
in the Python Language Reference
3.2. The standard type hierarchy
     numbers.Real (float)
         These represent machine-level double precision floating point 
numbers.
This  is not the meaning of "real" in mathematics!

I was surprised by the use of "integral". A dictionary search does not 
(IMHO) support this usage!
>
>    Thanks in advance!
>

-- 
Image and video hosting by TinyPic



More information about the Python-list mailing list