On Sun, 8 Jan 2023 at 20:20, dn <pythonl...@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 _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/MU4ZSUIIEKTZYQ3CWPD4WOV4POEHDVLX/ Code of Conduct: http://python.org/psf/codeofconduct/