Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #closure with state
- def multiplier(f):
- def times(n):
- return n*f
- return times
- #stateless function
- def times(a,b):
- return a*b
- mul2 = multiplier(2)
- print(mul2(4)) # 8
- print(times(2,4)) # 8
Advertisement
Add Comment
Please, Sign In to add comment