When I run the code: >>>i=5 >>>def f(arg=i): print(arg) >>>i=6 >>>f() It print 5.Why is this so??
A ankurankan Right off the assembly line Aug 23, 2011 #1 When I run the code: >>>i=5 >>>def f(arg=i): print(arg) >>>i=6 >>>f() It print 5.Why is this so??
Ishu Gupta Manchester United Aug 24, 2011 #2 In the second line, its read as def f(arg=5):. If you use f(i), it'll print 6.