Steven D’Aprano was giving me an idea (in the bytes.hex delimiter discussion):

I had very often the use case that I want to split sequences into subsequences 
of same size.
How about adding a chunks() and rchunks() function to sequences:

[1,2,3,4,5,6,7].chunks(3) => [[1,2,3], [4,5,6], [7]]
"1234“.chunks(2) => [“12“, “34“]

(this could then be used to emulate stevens proposal: “ 
“.join(“1234567“.chunks(2)) => “12 34 56 7“)

robert
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to