On 08/01/2023 17:06, James Addison wrote:
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)
I'd suggest going with the tuples and extra args in one proposal.
It possible that its more likely to be loved with the tuple as that
removes an objection.
Barry
_______________________________________________
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/4QZ53QOATFDYCUVWZW4GUUF6WCN5SOAG/
Code of Conduct: http://python.org/psf/codeofconduct/