pikapython/test/python/issue/issue_id_test.py
2022-09-28 10:57:19 +08:00

21 lines
323 B
Python

class Dog:
def __init__(self, name) -> None:
self.name = name
def eat(self):
print('self id = ', id(self))
print('%s eat...' % (self.name))
dog = Dog('dog1')
print('dog1 id = ', id(dog))
dog.eat()
def test():
dog = Dog('dog2')
print('dog2 id = ', id(dog))
dog.eat()
test()