Implicit Argument Passing in Python? -
the code below hackermeter.com , i'm not sure think of it. variable being passed implicitly run() or expect more modification specifies?
import sys def run(): # code here! in range(int(sys.stdin.readline())): run()
i'd argue poor coding practice. reason run()
has access i
i
global.
the following arguably better force programmer pass i
run()
explicitly (if required):
import sys def run(): # code here! def main(): in range(int(sys.stdin.readline())): run() if __name__ == '__main__': main()
Comments
Post a Comment