Message401750
On Sep 13, 2021, at 13:38, STINNER Victor <report@bugs.python.org> wrote:
> It seems like your proposal is mostly guided by: convert an int to a byte (bytes string of length 1). IMO this case is special enough to justify the usage of a different function.
Like bchr() ? <wink>
> What if people expect int.to_bytes() always return a single byte, but then get two bytes by mistake?
>
> ch = 256
> byte = ch.to_bytes()
The OverflowError you’ll get seems reasonable. |
|
Date |
User |
Action |
Args |
2021-09-14 05:08:53 | barry | set | recipients:
+ barry, rhettinger, mark.dickinson, ncoghlan, vstinner, mrabarnett, petr.viktorin, ethan.furman, serhiy.storchaka, veky, brandtbucher |
2021-09-14 05:08:53 | barry | link | issue45155 messages |
2021-09-14 05:08:52 | barry | create | |
|