Is it possible to have a mutable type that is not garbage collected?
- by user136109
I'm wondering if such a thing can exist. Can there be an object that is mutable but not flagged as garbage collected ( specifically, tp_flags & Py_TPFLAGS_HAVE_GC )
I have a C++ struct-like object that I'm writing and I'd like to know if all of its members are immutable. I'm thinking of checking for the Py_TPFLAGS_HAVE_GC flag to determine this. If all members are immutable I want to speed up the deepcopy by doing a faster shallow copy, since I know members are immutable then it shouldn't have to go through an expensive deep copy.
Is this logically sound, or is there some mythical type that will blow me out of the water here.