def get_img(url, dst):
get
什麼, 還不如使用更明確的
def download_image(url, dst):
i
, j
, k
等 通用 iteratorstmp
, return retval
這些變數不帶任何意義, 能不用則不用. 例外請見 1.3 def swap_values(a, b):
tmp = a
a = b
b = tmp
return a, b
tmp
, buffer
, 或是西瓜
, 我猜應該沒什麼影響pylint
就是個不錯的檢查工具
pylint YOUR_CODE.py
vim
中使用 :SyntasticCheck pylint
(須先安裝 vim-syntastic
) # training function
def train(...):
...
# 在給定的 subtree 找尋指定的 name, 最多找到 depth層
def find_node_in_subtree(subtree, name, depth)
# 找出有指定 'name' 的 node 或 回傳 None
# 如果 depth <= 0, 只會檢查 subtree
# 如果 depth == N, 只會檢查 subtree, 以及 N層內的 nodes
def find_node_in_subtree(subtree, name, depth)
# TODO(owner): 作者還沒處理的部份
# FIXME(owner): 已知的問題
# HACK(owner): 承認解決方法不夠優雅
# XXX(owner): 危險! 重要問題
NUM_THREADS = 8 # 只要 >= 2 * num_processors 就夠了