Will Python have partial string pattern matching in 3.14?
Basic
5
Ṁ1272025
25%
chance
1D
1W
1M
ALL
Something that solves this problem easily:
https://discuss.python.org/t/partial-string-matches-in-structural-pattern-matching/29960
I’d love to be able to use partial string matches:
match text: case "prefix_" + cmd: # checking prefix print("got", cmd) case "Hello " + last_name + ", " + first_name + "!": # more complex example print(last_name, first_name)
I know the various tricks using
split()
or guards (case s if s.startswith("prefix_")
), but this would be so much more intuitive for simple checks.
This question is managed and resolved by Manifold.
Get
1,000
and3.00