On Sun, 8 Jan 2023 at 20:20, dn <PythonList@danceswithmice.info> wrote:
(and hence earlier illustration/question: does the sep belong with the string forming the left-side of that partition, or the 'right'?)
There's no connection implied between each separator and the partitions that surround it in the results. In the username/host case, the '@' in 'user@host' isn't instrinsically linked to either the username or hostname component. (another way to think of it is like a meal-break during a work-day; the meal-break doesn't belong to either the part of the day preceding or the part of the day after the break)
Why limit the implementation to the same sequence as the separators are expressed in the method-call?
ie why should the order in which the separator arguments were expressed necessarily imply the same order-of-appearance in the subject-string?
There are two reasons for this, one consumer-side and one implementation-side: 1. It discourages consumers from attempting to partition strings with ambiguously-ordered delimiters 1. It allows the arguments to be scanned (iterated) exactly-once while the input is scanned (also iterated) exactly-once