py3k: converting int to bytes
tjreedy at udel.edu
Fri Feb 25 07:50:20 CET 2011
On 2/24/2011 9:25 PM, John Machin wrote:
> On Feb 25, 4:39 am, Terry Reedy wrote:
>> Note: an as yet undocumented feature of bytes (at least in Py3) is that
>> bytes(count) == bytes()*count == b'\x00'*count.
> Python 3.1.3 docs for bytes() say same constructor args as for
> bytearray(); this says about the source parameter: """If it is an
> integer, the array will have that size and will be initialized with
> null bytes"""
Yes, it is there in the builtin functions section, but not in the doc
strings. I opened an issue to fix the latter (#11310), with a proposed
Terry Jan Reedy
More information about the Python-list