Retrieving the list of references to an object in Python

后端 未结 7 1264
栀梦
栀梦 2020-12-04 01:29

All:

a = 1
b = a
c = b

Now I want to get a list of object 1 tagged, which is [a, b, c]. How could I do this?

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 02:17

    Look at pyjack. Its replace_all_refs function seems to work pretty well to replace all references to an object. Note: Doesn't work well with string objects.

提交回复
热议问题