> My question is -- how can the interpreter know if it can alter what is > supposed to be an immutable in-place? If it's used only internally to a > function, the it would be safe, but how to know that? > -CHB You can just check the reference count of your object, it's a member of the PyObject structure which every CPython object contains: ob_refcnt. This will indicate if your object is referenced by other Python variables or by Python containers such as lists, tuples, dicts, sets etc.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4