Perhaps use the id of an object instead of its value. Here's how it might
work

>>> store = {}

>>> def wibble(fn):
...       val = fn()
...       name = fn.__name__
...       store[id(val)] = name
...       return val

>>> @wibble
... def ddd():
...     return tuple(range(4))

>>> ddd
(0, 1, 2, 3)
>>> store[id(ddd)]
'ddd'
>>>

>>> x = ddd
>>> ddd = None
>>> store[id(x)]
'ddd'

I hope this helps.

-- 
Jonathan
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/V2RON2KVFVECTZMLXHJV3KJKNSLNQHA5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to