osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

optional int- and float arguments


On Wed, Oct 4, 2017 at 3:18 AM, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
>   ?int? and ?float? seem to behave quite similar:
>
> |>>> int( x = 8 )
> |8
> |>>> float( x = 8.0 )
> |8.0
> |>>> int()
> |0
> |>>> float()
> |0.0
>
>   . Yet the ways their parameters are being documented in
>   "The Python Library Reference, Release 3.6.0" seem to differ:
>
> |class float([x])
> |class int(x=0)
>

Huh. I just checked help() in Python 3.7, and it's the other way around.

 |  float(x=0, /)
 |  int([x]) -> integer

>   Would there be any error in describing ?float? using
>
> |class float(x=0.0)
>
>   ?

I don't think so. This is a strange inconsistency in the docs, given
that they behave the same way. Would be worth opening a tracker issue,
mentioning all four things you found.

ChrisA