[Python-ideas] Match statement brainstorm

Joao S. O. Bueno jsbueno at python.org.br
Mon May 23 14:45:20 EDT 2016

I still fail to see what justifies violating The One Obvious Way to Do It which
uses an if/elif sequence so blatantly beyond the
feeble "Yet, some kind of switch statement is found in many languages
and it is not unreasonable to expect that its addition to Python will
allow us to write up certain code more cleanly and efficiently than
before." in the rejected PEP.

It is not like omitting the object reference name on the conditional
expression (and therefore,
a condition expression that is tied to one object)  is more readable at all.

But them, it is the BDLF cming with the proposal - I am just this
Python develoepr teacher, that just last Wednesday was saying
something along on a crash course:
"We don  need switch/case because it is just a special case of an
if/elif sequence,
that was meaningful when  C compilers did not had resources to optimize
that themselves".

I argue no further, if people still see this as desirable.Ths is just my plain
Python user "-1" on python-ideas.


On 22 May 2016 at 14:50, Random832 <random832 at fastmail.com> wrote:
> On Fri, May 20, 2016, at 15:25, Jim Baker wrote:
>> Agreed, if we want to support the structural pattern matching as seen in
>> Haskell, Rust, or Scala, we should do the following:
>>    - Raise a match error if the match is not exhaustive; an `else` clause
>>    is fine for exhaustion
> This is required because the analogous constructs in those languages are
> expressions that return a value, and there's no reason to require it for
> a python construct which is a statement.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

More information about the Python-ideas mailing list