Python 3.x and bytes
Ian Kelly
ian.g.kelly at gmail.com
Tue May 17 16:52:43 EDT 2011
On Tue, May 17, 2011 at 2:20 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> The big question, though, is would you do it this way:
>
> some_var = bytes(23).replace(b'\x00', b'a')
>
> or this way?
>
> some_var = bytes(b'a' * 23)
Actually, I would just do it this way:
some_var = b'a' * 23
That's already a bytes object. Passing it into the constructor is redundant.
More information about the Python-list
mailing list