7 May
2019
7 May
'19
2:18 p.m.
Steven D'Aprano wrote:
That suggests a possible pair of constructors:
bytes.from_int(n) -> equivalent to b'%d' % n bytes.ord(n) -> equivalent to bytes((n,))
I don't see how bytes.from_int(n) is any clearer about what it does than just bytes(n). If we're going to have named constructors, the names should indicate *how* the construction is being done, not just repeat the type of the argument. -- Greg