Why is id different through id() and through the cheat engine?

110 Views Asked by At

When I run the code and then check the variable id using the cheat engine, they are different, why?

Here's what i have:

import time

x = 500

while True:
    time.sleep(1)
    print(f'ID: 0x{format(id(x), "X")}\nValue: {x}')

code result and cheat engine

1

There are 1 best solutions below

0
Tim Roberts On BEST ANSWER

The "cheat engine" is showing you the location of the data itself. The id is the address of the integer object. Each object (even integers) has structure overhead.