
On 7/29/21 3:46 PM, Barry Warsaw wrote:
We’re generally very favorable for adding to Python 3.11 the features and APIs described in the PEP. We have some requests for changes that we’d like you to consider.
- The Python-Version in the PEP needs to target Python 3.11 of course.
Done.
- We think it would be better if bytes.fromsize()’s second argument was a keyword-enabled or keyword-only argument.
We understand the rationale given in the PEP for not doing so, but ultimately we think the readability of (at least allowing) a keyword argument to be more compelling. Some possible options include `fill`, `value`, or `byte`.
Done, went with "fill" as an optional keyword argument.
- We all really dislike the word “ord” as in `bytes.fromord()`. We understand the symmetry of this choice, but we
also feel like we have an opportunity to make it more understandable, so we recommend `bytes.fromint()` and `bytearray.fromint()`.
Done.
- We think the `bchr()` built-in is not necessary. Given the `.fromint()` methods, it’s better not to duplicate the
functionality, and everything has a cost. A built-in that exists only for the symmetry described in the PEP is just a little extra complexity for little value.
I would rather keep `bchr` and lose the `.fromint()` methods.
To get bytes:
some_var = bchr(65) vs some_var = bytes.fromint(65)
and for bytearrays
some_var = bytearray(bchr(65)) vs some_var = bytearray.from_int(65)
Let me know if I should drop `.fromint()`.
-- ~Ethan~