2014-10-18 66 views

回答

2

Python有一個內置常量__debug__可用於此目的。

python -O something.py # __debug__ == False 
python something.py # __debug__ == True 

注意,這裏也是assert聲明,可以完全優化掉。 。 。

相關問題