How does Python convert bytes into float? : <p>I have the following code snippet:</p>

<pre><code>#!/usr/bin/env python3

print(float(b'5'))
</code></pre>

<p>Which prints <code>5.0</code> with no error (on Linux with utf-8 encoding). I'm very surprised that it doesn't give an error since Python is not supposed to know what encoding is used for the bytes object.</p>

<p>Any insight?</p>
