Title: Explicitly mention bytes and other buffers in the documentation for float()
Type: Stage:
Components: Versions:
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: joelthelion, mjpieters
Priority: normal Keywords:

Created on 2018-05-18 10:41 by mjpieters, last changed 2018-05-18 12:00 by joelthelion.

Messages (1)
msg317022 - (view) Author: Martijn Pieters (mjpieters) * Date: 2018-05-18 10:41
float(bytesobject) treats the contents of the bytesobject as a sequence of ASCII characters, and converts those to a float value as if you used float(bytesobject.decode('ASCII')). The same support is extended to other objects implementing the buffer protocol.

The documentation, however, doesn't mention this:

> Return a floating point number constructed from a number or string x.

Everywhere else in the functions documentation, "string" refers to an object of type `str`. Please make it explicit that `bytes` is also acceptedable, like it does for the int() documentation.
Date User Action Args
2018-05-18 12:00:07joelthelionsetnosy: + joelthelion
2018-05-18 10:41:41mjpieterscreate