common mistakes in this simple program

Marko Rauhamaa marko at pacujo.net
Mon Feb 29 15:29:54 EST 2016


sohcahtoa82 at gmail.com:

> Every time you say "try-expect", my head wants to explode.
>
> It is called a "try-except" block, because you're using the key words
> "try" and "except" when you make one.

Ah, I remember a Python-based test system idea where the "except"
keyword meant "expect":

    try: event()
    except user.CloseRequest():
        ...
    except user.SendRequest():
        ...
    except peer.DataIndication():
        ...
    except Timeout():
        ...

etc.

In the end, though, we came up with something better.


Marko



More information about the Python-list mailing list