-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
area/protocolskind/design-issueA conversation around designA conversation around designtriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked onA consensus emerged that this bug report, feature request, or other action should be worked on
Description
Measurement and control keys protocols both do defensive copies before returning. However they are also used in hot loops where perf is important. It's likely better to specify that dunders should return return a frozenset instead, especially since most ops will return an empty one, which is a singleton requiring no allocation.
This may be impossible to do in a completely non breaking way, however I can't think of a reason users would rely on these returning mutable sets.
Update: The mypy types of the return values is AbstractSet, not Set. And FrozenSet is also a subclass of AbstractSet so this is not breaking.
Metadata
Metadata
Assignees
Labels
area/protocolskind/design-issueA conversation around designA conversation around designtriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked onA consensus emerged that this bug report, feature request, or other action should be worked on