On Sat, 26 Feb 2022 at 07:32, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-02-25 at 13:48:32 -0600, > "Michael F. Stemper" <michael.stem...@gmail.com> wrote: > > > On 25/02/2022 12.07, Abdur-Rahmaan Janhangeer wrote: > > > > I have been following language feature proposals from various > > > languages. Some decide to avoid Python's route, but others have been > > > trying hard to catch up with Python. One gleaming example is the > > > switch case. JS recently proposed pattern matching, referencing > > > Python and explaining why the proposal is a cool treatment of the > > > usecase. > > > I'm not clear on what you mean here. JavaScript has had a switch/case > > construct since 1.2, in the late 1990s. As far as I can determine, > > python has no such thing, since PEP-3103 was rejected in 2007. > > Python has a relatively new (as of version 3.10) "match" statement: > > > https://docs.python.org/3/reference/compound_stmts.html#the-match-statement
Every language learns from every other. Python has learned from JavaScript too. Both languages have learned from Haskell. Pike has learned from Python; and Python has learned from Pike. Nearly every language learns from C and Smalltalk (sometimes indirectly). Of course, not everything that is learned is copied - sometimes what you learn is "let's not do it that way". Python's match statement is not a switch/case block, and if JS is borrowing the idea, then that's strong evidence that, even with switch/case, match/case is a valuable addition. They behave very differently in usage. ChrisA -- https://mail.python.org/mailman/listinfo/python-list