Will Python have partial string pattern matching in 3.14?
Basic
5
Ṁ127
2025
25%
chance

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.

Get
Ṁ1,000
and
S3.00
© Manifold Markets, Inc.Terms + Mana-only TermsPrivacyRules