@@ -818,7 +818,7 @@ are always available. They are listed here in alphabetical order.
818818 single: NaN
819819 single: Infinity
820820
821- Return a floating-point number constructed from a string, number , or bytes-like object, if possible .
821+ Return a floating-point number constructed from a number, a string , or a bytes-like object.
822822
823823 Examples:
824824
@@ -836,19 +836,14 @@ are always available. They are listed here in alphabetical order.
836836 -inf
837837 >>> float (bytearray (b ' -2.5' ))
838838 -2.5
839- >>> float (array.array(' b' , [49 , 50 , 51 ]))
840- 123.0
839+ >>> float (array.array(' b' , [49 , 50 , 46 , 54 , 55 ]))
840+ 12.67
841841
842842 If the argument is a string, it should contain a decimal number, optionally
843843 preceded by a sign, and optionally embedded in whitespace. The optional
844844 sign may be ``'+' `` or ``'-' ``; a ``'+' `` sign has no effect on the value
845845 produced. The argument may also be a string representing a NaN
846846 (not-a-number), or positive or negative infinity.
847-
848- If the argument is a bytes-like object, its contents are parsed as a decimal
849- string. Therefore, the bytes-like object must contain a valid textual
850- representation of a floating-point number; otherwise :exc: `ValueError ` is raised.
851-
852847 More precisely, the input must conform to the :token: `~float:floatvalue `
853848 production rule in the following grammar, after leading and trailing
854849 whitespace characters are removed:
@@ -868,6 +863,9 @@ are always available. They are listed here in alphabetical order.
868863 Case is not significant, so, for example, "inf", "Inf", "INFINITY", and
869864 "iNfINity" are all acceptable spellings for positive infinity.
870865
866+ If the argument is a bytes-like object, it must contain only ASCII characters
867+ that conform to the :token: `~float:floatvalue ` rule.
868+
871869 Otherwise, if the argument is an integer or a floating-point number, a
872870 floating-point number with the same value (within Python's floating-point
873871 precision) is returned. If the argument is outside the range of a Python
0 commit comments