Ian Kelly wrote:
On Tue, May 17, 2011 at 2:20 PM, Ethan Furman <et...@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.

However, as I just discovered, it works well when dealing with a bytearray object:

some_var = bytearray(b' ' * size) # want space initialized, not null

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to