-2
import sys
import gc

def func_a(a,b,c):
    print(a,b,c)

def func_b():
    print("b")

a = func_b()
b = func_a(1,2,3)
print(id(a) == id(b))
print(a is b)

class c_1():
    def __init__(self) -> None:
        pass

class c_2():
    def __init__(self) -> None:
        pass

c1 = c_1()
c2 = c_2()
print(id(c1) == id(c2))
print(c1 is c2)

output:

b
1 2 3
True
True
False
False

Any idea why a is equal to b? when i add return 1 or not None return to a, a is not equal to b. Thank you.

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30
  • Welcome to Stack Overflow. I can't understand the underlying thought process here. What do you think the question has to do with "memory management"? What do you think that means, in the first place? – Karl Knechtel Feb 09 '23 at 08:28

1 Answers1

1

Your functions do not explicitly return anything. Therefore they implicitly return None. Thus both a and b are equal to None

DarkKnight
  • 19,739
  • 3
  • 6
  • 22