[Python-ideas] switch statement as context manager?

Sturla Molden sturla.molden at gmail.com
Mon Feb 10 15:31:24 CET 2014


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

Would this be something to consider for the standard lib, e.g. contextlib?

Sturla



More information about the Python-ideas mailing list