This was discussed/litigated/holy wars fought over at extreme length, I suggest you peruse the email archives searching for PEP 622 or 634 and also this might be a helpful jumping off point: https://github.com/gvanrossum/patma/issues.
On Wed, 2 Jun 2021 at 04:18, Julia Schmidt <[email protected]> wrote: > 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 -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/EJE2T26LP3JPWK3YHGZVQFRRMOPKOQDL/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/6T72HRPQSXMSXNWRZ5DF4NGWDDI35VI2/ Code of Conduct: http://python.org/psf/codeofconduct/
