New submission from Martijn Pieters <m...@python.org>: 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. ---------- messages: 317022 nosy: mjpieters priority: normal severity: normal status: open title: Explicitly mention bytes and other buffers in the documentation for float() _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33567> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com