Author barry
Recipients barry, brandtbucher, ethan.furman, mark.dickinson, mrabarnett, ncoghlan, petr.viktorin, rhettinger, serhiy.storchaka, veky, vstinner
Date 2021-09-14.05:08:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <4BDF43A4-C918-4397-BF24-FAD6C107585F@python.org>
In-reply-to <1631565486.98.0.886822145255.issue45155@roundup.psfhosted.org>
Content
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.
History
Date User Action Args
2021-09-14 05:08:53barrysetrecipients: + barry, rhettinger, mark.dickinson, ncoghlan, vstinner, mrabarnett, petr.viktorin, ethan.furman, serhiy.storchaka, veky, brandtbucher
2021-09-14 05:08:53barrylinkissue45155 messages
2021-09-14 05:08:52barrycreate