Clarity vs. code reuse/generality

kj no.email at please.post
Sat Jul 4 11:05:48 EDT 2009


In <zxr3m.613$P5.65 at nwrddc02.gnilink.net> Alan G Isaac <alan.isaac at gmail.com> writes:

>> In <mGo3m.591$P5.76 at nwrddc02.gnilink.net> Alan G Isaac <alan.isaac at gmail.com> writes:
>>> 1. Don't use assertions to test argument values!


>On 7/3/2009 12:19 PM kj apparently wrote:
>> Out of curiosity, where does this come from? 


>http://docs.python.org/reference/simple_stmts.html#grammar-token-assert_stmt
>"The current code generator emits no code for an assert statement when optimization is requested at compile time."

Sorry, this doesn't say anything like "don't use assertions to test
argument values".  I'm aware of the fact that assertions are silenced
under certain circumstances.  But where does the principle 1. in
your first reply come from?  I've never seen it before, and would
like to understand the reasoning behind it.

kj



More information about the Python-list mailing list