有
__debug__,这是编译器进行预处理的特殊值。
if __debug__: print "If this prints, you're not running python -O."else: print "If this prints, you are running python -O!"
__debug__将由编译器替换为常数0或1,并且优化器将
if 0:在解释源之前删除所有行。

有
__debug__,这是编译器进行预处理的特殊值。
if __debug__: print "If this prints, you're not running python -O."else: print "If this prints, you are running python -O!"
__debug__将由编译器替换为常数0或1,并且优化器将
if 0:在解释源之前删除所有行。