On Sun, 8 Jan 2023 at 13:20, Barry Scott <barry@barrys-emacs.org> wrote:
Maybe combine the ideas by allowing a tuple where a string is used.
'a=b;c'.partition('=', (':',';')) => ('a', '=', b, ';', 'c')
I like that idea - and it seems to fit neatly with the existing partition contract: the inclusion of the matched-delimiter as an item in the result-tuple would reduce match ambiguity (rationale: imagining a use case where a caller would like to provide multiple delimiters during method invocation, and then subsequently check which delimiter was used at a given match position). Since it's both orthogonal to (does not depend-on, nor is it a dependency-of) multiple-partition-arguments and composible with (can be combined with) multiple-partition-arguments, perhaps it should be advocated-for as a separate proposal? (rationale: that would allow either proposal to advance without delaying the other -- bearing in mind a hopefully-unlikely chance of merge conflicts if they reach release-readiness implementation status in parallel)