Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は今、次のコードを持っています
if (verbose): with hide('running', 'stdout', 'stderr'): line 1 line 2 else: line 1 line 2
line1 と line2 の繰り返しを避ける方法はありますか?
def dothisstuff(): line 1 line 2 if (verbose): with hide('running', 'stdout', 'stderr'): dothisstuff() else: dothisstuff()
ただし、これは 2 行を 2 回繰り返すだけではやり過ぎかもしれません。しかし、2行以上だと思います:)