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
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to