On Sat, May 19, 2018 at 2:32 AM, Chris Barker via Python-ideas <python-ideas@python.org> wrote: > On Thu, May 17, 2018 at 11:07 PM, Greg Ewing <greg.ew...@canterbury.ac.nz> > wrote: >> >> Steven D'Aprano wrote: >>> >>> But XORing bytes seems perfectly reasonable. Bytes are numbers, even if >>> we display them as ASCII characters. > > > actually, bytes are, well, bytes ;-) -- that is, 8 bits.
Grammatically, you appear to be disagreeing with the assertion that bytes are numbers. Is that the case? If you want to be extremely technical, an "octet" is a group of eight bits (or eight musicians, but I haven't yet figured out how to send musicians down an ethernet cable), and a "byte" isn't as rigidly defined. But on modern PCs, you can fairly safely assume that they're synonymous. I suppose you could argue that a "byte" is a patch of storage capable of holding a number from 0 to 255, as opposed to being the number itself, but that's getting rather existential :) In Python, a "bytes" object represents a sequence of eight-bit units. When you subscript a bytes [1], you get back an integer with the value at that position. So if a collection of them is called a "bytes" and one of them is an integer in range(0, 256), doesn't it stand to reason that a byte is a number? Maybe I'm completely misunderstanding your statement here. ChrisA [1] Yes, I'm aware that older versions of Python behaved differently. [2] [2] I'm also aware that putting square brackets after the word "bytes" could be interpreted as subscripting the 'bytes' type itself, rather than creating a reference to a footnote. Ain't contextual grammar fun? _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/