On 5/1/2017 1:41 PM, Alexandre Brault wrote:
On 2017-05-01 01:34 PM, Ethan Furman wrote:
On 05/01/2017 07:04 AM, Juancarlo Añez wrote:
On Mon, May 1, 2017 at 9:38 AM, Nick Coghlan wrote:
just support two
keyword arguments to hex(): "delimiter" (as you suggest) and
"chunk_size" (defaulting to 1, so you get per-byte chunking by
default)
I'd expect "chunk_size" to mean the number of hex digits (not bytes)
per chunk.
I was also surprised by that. Also, should Python be used on a
machine with, say, 24-bit words then a chunk size of three makes more
sense that one of 1.5. ;)
--
~Ethan~
A hex digit is 4 bits long. To separate into words, the 24-bit word
Python would use 3 (counting in bytes as initially proposed), or 6
(counting in hex digits). Neither option would result in a 1.5
chunk_size for 24-bit chunks.
Counting chunk_size either in nibbles or bytes seem equally intuitive to
me (as long as it's documented).
Call the paramater 'octets' and it should be clear that it means 8 bit
chunks. Do any machine now use anything else?
--
Terry Jan Reedy
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/