[issue35701] [uuid] 3.8 breaks weak references for UUIDs

Josh Rosenberg report at bugs.python.org
Thu Jan 17 20:51:19 EST 2019


Josh Rosenberg <shadowranger+python at gmail.com> added the comment:

The UUID module documentation (and docstring) begin with:

"This module provides immutable UUID objects"

Immutable is a stronger guarantee than __slots__ enforces already, so the documentation already ruled out adding arbitrary attributes to UUID (and the __setattr__ that unconditionally raised TypeError('UUID objects are immutable') supported that.

Given the behavior hasn't changed in any way that contradicts the docs, nor would it affect anyone who wasn't intentionally working around the __setattr__ block, I don't feel a need to mention the arbitrary attribute limitation.

It's fine to leave in the What's New note (it is a meaningful memory savings for applications using lots of UUIDs), but the note can simplify to just:

"""uuid.UUID now uses __slots__ to reduce its memory footprint."""

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35701>
_______________________________________


More information about the Python-bugs-list mailing list