It looks cooler. It also feels slightly less aggravating.


On Mon, Feb 10, 2014 at 5:29 PM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Sturla Molden wrote:
I've noticed that PyExt has a switch statement implemented as a context
manager.

with switch(foobar):
    if case(1): pass
    if case(2): pass

What advantage does this have over an if-else chain?

--
Greg

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/



--
Ryan
If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."