>From https://docs.python.org/3.10/whatsnew/3.10.html:
def http_error(status): match status: case 400: return "Bad request" case 404: return "Not found" case 418: return "I'm a teapot" case _: return "Something's wrong with the Internet" The wildcard idea looks just wrong and confusing. What if I want to use it as a variable and match against it like _ = 504? This is how it should be done: def http_error(status): _ = 504 match status: case 400: return "Bad request" case 404: return "Not found" case 418: return "I'm a teapot" case _: return "Gateway Timeout" else: return "Something's wrong with the Internet"
_______________________________________________ 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/EJE2T26LP3JPWK3YHGZVQFRRMOPKOQDL/ Code of Conduct: http://python.org/psf/codeofconduct/