码迷,mamicode.com
首页 > 编程语言 > 详细

[python] 高效使用assert

时间:2014-12-06 21:32:45      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:io   ar   使用   sp   on   cti   ad   as   tt   

Places to consider putting assertions:

  • checking parameter types, classes, or values
  • checking data structure invariants
  • checking "can‘t happen" situations (duplicates in a list, contradictory state variables.)
  • after calling a function, to make sure that its return is reasonable

[python] 高效使用assert

标签:io   ar   使用   sp   on   cti   ad   as   tt   

原文地址:http://www.cnblogs.com/zhizouxiao/p/4148718.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!