How does local symbol table interact in calling functions in python?

def fib(n):    # write Fibonacci series up to n >"""Print a Fibonacci series up to n.""" >a, b = 0, 1 >while a < n: >>print(a, end=' ') >>a, b = b, a+b >print()  `fib` <function fib at 10042ed0> 

The terminal returns ‘function fib a 10042ed0’ when fib is entered. What is 10042ed0 and where and when is it formed?

Add Comment
1 Answer(s)

A function definition introduces the function name in the current symbol table. The value of the function name has a type that is recognized by the interpreter as a user-defined function. This value can be assigned to another name which can then also be used as a function.

Here is where i got this: http://insti.physics.sunysb.edu/itp/computing/doc/python/python-tut/section2_5_6.html

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.