Every time I try to print the location of a function, it gives different value. but location of a variable printed using id() gives out the same value every time. I am using python v3. Below is the code.
def func():
pass
x = 10
print('ID for variable x: {}'.format(hex(id(x))))
print('ID for function: {}'.format(func))
and below is it's output,
PS C:\users\xyz\python> python new.py
ID for variable x: 0x6e7fa580
ID for function: <function func at 0x000002C1AA5A3E18>
PS C:\users\xyz\python> python new.py
ID for variable x: 0x6e7fa580
ID for function: <function func at 0x0000026F92C13E18>
PS C:\users\xyz\python> python new.py
ID for variable x: 0x6e7fa580
ID for function: <function func at 0x00000268DA153E18>