[Python-projects] Assertions, type checking, and testing

Didrik Pinte dpinte at itae.be
Thu Jun 22 09:06:08 CEST 2006


Le mercredi 21 juin 2006 à 19:41 +0200, Maarten ter Huurne a écrit :
> However, I usually leave on all assertions in production code. The
> reasons people give for turning off assertions are typically: 
> - Performance. 
> - Avoid crashes if assertion is triggered. 
> 
> About performance: most assertions don't take much effort to check,
> total overhead is typically below 10%. If you consider that to be too
> much overhead, you shouldn't be using Python anyway ;) 

Just a little comment on the assert left in code : when using Python
with the -O option (optimisation option), they are untested :

"The current code generator emits no code for an assert statement when
optimization is requested at compile time." 
(http://docs.python.org/ref/assert.html)

Didrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20060622/b416a283/attachment.pgp


More information about the Python-Projects mailing list