Maestro Stefano, questo sembra bellissimo! :-)
On 14.10.20 16:13, Stefano Miccoli via Owfs-developers wrote:
> A more succinct way would be:
>
> str(x).encode()
>
> In fact the outer call to ‘bytes’ in 'bytes(str.encode(str(x)))' is a
> no-op, and python strings are objects which have an ‘encode'
Thanks Stefano, that looks much better.
On 14/10/2020 15:13, Stefano Miccoli via Owfs-developers wrote:
A more succinct way would be:
str(x).encode()
In fact the outer call to ‘bytes’ in 'bytes(str.encode(str(x)))' is a
no-op, and python strings are objects which have an ‘encode' method,
so
A more succinct way would be:
str(x).encode()
In fact the outer call to ‘bytes’ in 'bytes(str.encode(str(x)))' is a no-op,
and python strings are objects which have an ‘encode' method, so no need call
the class method ’str.encode’.
Another possible way is
f"{x:d}".encode()
or
"{:d}".forma