Opened 7 years ago

Closed 7 years ago

#1562 closed defect (fixed)

Contradiction in Collection documentation

Reported by: Tristan Croll Owned by: Tom Goddard
Priority: minor Milestone:
Component: Documentation Version:
Keywords: Cc: Eric Pettersen
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Minor thing, but...

In docstring for atomic.Collection (and similar statements in method docstrings):

"By design, a Collection is immutable"

In docstring for collection.hash():

"... it is not supported to use collections as keys of dictionaries or elements of sets since they are mutable."

Change History (2)

comment:1 by Eric Pettersen, 7 years ago

Cc: Eric Pettersen added; Tom Goddard removed
Owner: changed from Eric Pettersen to Tom Goddard

Collections are "immutable" in that their contents cannot be modified by API calls. Nonetheless, they can't be used as keys because they can spontaneously change as the items they contain are deleted by external calls. Reassigning to Tom since Collections are his "baby", so he can elaborate in the documentation if he wants to clarify further.

comment:2 by Tom Goddard, 7 years ago

Resolution: fixed
Status: assignedclosed

The current documentation in molarray.py already says:

"Collections are mostly immutable. The only case in which their contents
can be altered is if C++ objects they hold are deleted in which case those objects
are automatically removed from the collection. Because they are mutable they
cannot be used as keys in dictionary or added to sets."

I added a few more comments on Collection methods that mention mutability.

Note: See TracTickets for help on using tickets.