Skip to content

trivial __copy__ and __deepcopy__ methods for Family and Set #32462

@mkoeppe

Description

@mkoeppe

The constructors Family and Set are intended to construct an immutable Parent.

We equip the implementation classes with trivial __copy__ and __deepcopy__ methods that just return self.

Parents that subclass CachedRepresentation/UniqueRepresentation already have these methods, but the implementation classes of Family and Set do not.

Slightly tricky is the question how to deal with mutable elements. Set documents that:

    Sets with unhashable objects work, but with less functionality::

        sage: B = Set([QQ, [3, 1], 5])  # unhashable

Should a copy be made? Should it be documented that by creating the Set, a mutable element belongs to the set object in the sense of object ownership and it is an error to mutate it?

CC: @tscrim @nbruin

Component: refactoring

Issue created by migration from https://trac.sagemath.org/ticket/32462

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions