SteveA and Kiko suggest a base class ContentObjectSet and interface IContentObjectSet with a consistent interface for common functionality.
Some of the *Set classes allow you to retrieve objects by name, others by id, some both, some by yet other attributes. As a first phase we will make this more explicit by replacing get() with getByName(), getById() etc. (Perhaps a getBy() that takes the identifying attribute as an argument?) We'll also get rid of __getitem__ to avoid conflicts between different classes' expectations.
We could also have a single get() that figures out the right type of search based on the type of its argument, but that may be ambiguous or hide mistakes.
SteveA and Kiko suggest a base class ContentObjectSet and interface IContentObjectSet with a consistent interface for common functionality.
Some of the *Set classes allow you to retrieve objects by name, others by id, some both, some by yet other attributes. As a first phase we will make this more explicit by replacing get() with getByName(), getById() etc. (Perhaps a getBy() that takes the identifying attribute as an argument?) We'll also get rid of __getitem__ to avoid conflicts between different classes' expectations.
We could also have a single get() that figures out the right type of search based on the type of its argument, but that may be ambiguous or hide mistakes.