How to implement pointers in Python? (or any similar solution else)
问题 I have a Class, it will be implemented to be many instances. I want to keep connections between some of the instances, and pass messages among them. In C++, I can do this like: class A { A (*connections)[]; int sum; public: void pass(int index) { connections[index] -> receive(sum); } void receive(int input) { sum += input; } } Then I only need to add pointers of other instances to connections[] , I can pass messages among them with each other. Currently I have to use Python doing this, but