> I would rather keep `bchr` and lose the `.fromint()` methods.
For me, "bchr" isn't a readable name. If I expand mentally expand it to
"byte_character", it becomes an oxymoron that opposes what we try teach about
bytes and characters being different things.
Can you show examples in existing code of how this would be used? I'm unclear
on how frequently users need to create a single byte from an integer. For me,
it is very rare. Perhaps once in a large program will I search for a record
separator in binary data. I would prefer to write it as:
RS = byte.fromint(30)
...
i = data.index(RS, start)
...
if RS in data:
Having this as bchr() wouldn't make the code better because it is less explicit
about turning an integer into a byte. Also, it doesn't look nice when in-lined
without giving it a variable name:
i = data.index(bchr(30), start) # Yuck
...
if bchr(30) in data: # Yuck
Also keep in mind that we already have a way to spell it, "bytes([30])", so any
new way needs to significantly add more clarity. I think bytes.fromint() does
that.
The number of use cases also matters. The bar for adding a new builtin
function is very high.
Raymond
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/DOUFRRLGMAFYJZ4ONYK6CKHHCYKPXJBW/
Code of Conduct: http://python.org/psf/codeofconduct/