I love assert
Marko Rauhamaa
marko at pacujo.net
Wed Nov 12 16:56:18 EST 2014
More information about the Python-list mailing list
Wed Nov 12 16:56:18 EST 2014
- Previous message (by thread): I love assert
- Next message (by thread): I love assert
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ethan Furman <ethan at stoneleaf.us>: > On 11/12/2014 01:41 PM, Marko Rauhamaa wrote: >> >> Or I might indicate the exhaustion of possibilities: >> >> if status == OK: >> ... >> elif status == ERROR: >> ... >> else: >> assert status == WARNING >> ... > > And here's a nice example of what one should NOT do. Imagine that a > new status, CONFUSED is added, the above code is not modified to > handle it, and for whatever reason the program is being run optimized > -- the assert is not there, and CONFUSED is treated the same as > WARNING. How would it be better if you removed the assert then? Marko
- Previous message (by thread): I love assert
- Next message (by thread): I love assert
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list