This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brandtbucher
Recipients BTaskaya, Daniel Moisset, brandtbucher, gvanrossum, kj, lys.nikolaou, pablogsal, willingc
Date 2021-02-19.23:56:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I understand. I would just like to see something that won't give new Python pattern-matching users (read: everybody) the very painful first impression that this is a switch. Can we rework it like:

match input().split():
    case []:
        print("Got nothing!")
    case [first]:
        print(f"Got one word: {first}")
    case [first, last]:
        print(f"Got two words: {first} and {last}")
    case _:
        print("Got more than two words!")

Or something? (Pardon the example, I don't write many tutorials...)

I've seen too many knee-jerk reactions over the past weeks along the lines of "the new switch feature can't handle named constants!". My hope is something like the above might provide a more accurate, informative intro.
Date User Action Args
2021-02-19 23:56:56brandtbuchersetrecipients: + brandtbucher, gvanrossum, willingc, Daniel Moisset, lys.nikolaou, pablogsal, BTaskaya, kj
2021-02-19 23:56:56brandtbuchersetmessageid: <>
2021-02-19 23:56:56brandtbucherlinkissue42128 messages
2021-02-19 23:56:55brandtbuchercreate