Cameron Simpson wrote:
one could change implementations such that applying a docstring to an object _removed_ it from the magic-shared-singleton pool,
That's not sufficient, though. Consider: BUFFER_SIZE = 256 BUFFER_SIZE.__doc__ = "Size of the buffer" TWO_TO_THE_EIGHT = 256 TWO_TO_THE_EIGHT.__doc__ = "My favourite power of two" Before the code is even run, the compiler may have merged the two occurences of the integer literal 256 into one entry in co_consts. By the time the docstrings are assigned, it's too late to decide that they really needed to be different objects. So, an int with a docstring needs to be explicitly created as a separate object to begin with, one way or another. -- Greg -- https://mail.python.org/mailman/listinfo/python-list