PEP new assert idiom

Paul Rubin http
Sun Nov 7 07:48:34 CET 2004


"Raymond Hettinger" <vze4rx4y at verizon.net> writes:
> Why do you need a statement for this?
> IMO, a plain function will do the trick:

I do write such functions sometimes, but using a statement is more
natural.  That's why the assert statement exists, for example.

Because of that naturalness, the temptation to misuse the assert
statement is very great, and I find myself doing it all the time
thinking I'll clean it up later.  So I think having a statement for
runtime checking would be in the correct spirit.



More information about the Python-list mailing list