selfteaching / the-craft-of-selfteaching

One has no future if one couldn't teach themself.
15.24k stars 16.5k forks source link

关于去掉封面中“create(*args)”函数参数的建议 #403

Open richardchen0954 opened 5 years ago

richardchen0954 commented 5 years ago

这是本书封面中的 “teach_yourself”函数:

def teach_yourself(anything):
    while not create(something):
        learn()
        practice()
    return teach_yourself(another)

其中的 create 函数带了个 “something” 参数,感觉在这个语境下读起来多少有一丢丢让人误解为“ create 函数产生 something 结果(即,创造了something出来)”的可能,但其实,这里的 “something” 是要传给 create 的参数(即,创造过程用到的something)。当然,这样写逻辑上依然没有问题,只不过讲道理这个 create 函数最终产生的something并非这个参数something。愚以为,可以考虑去掉这个参数,即:

def teach_yourself(anything):
    #while not create(something):
    while not create():
        learn()
        practice()
    return teach_yourself(another)
ZhuPeng commented 5 years ago

应该函数名叫 create_something 吧

From WeChat Mini Programe: GitHub Trending Hub

xiaolai commented 5 years ago

同意,有道理。我:d9d3350d6d26963346573ae6ed9ac76091898403 。

xiaolai commented 5 years ago

d9d3350d6d26963346573ae6ed9ac76091898403

coolit commented 5 years ago

another 改成 another thing ,更加明确