On Sun, 8 Jan 2023 at 13:20, Barry Scott <ba...@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)
_______________________________________________
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/5BZWICH7CSJHHGT7XOPVANF74Q4WG7RN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to