For example, I have a variable called a, and need to change it by its memory address:
a: str = "hello"
address: int = id(a)
change_by_address(address, a, 'newval') # is something like this possible?
Is there some way to do this, perhaps in the ctypes library?
>Solution :
Absolutely, positively not. That ID is an address of SOMETHING in memory, but in C terms these are all moderately complicated data structures.
Python is not C. You cannot think of things in the same way.