Skip to content

PlanePartitions are not hashable #36118

Closed
@mantepse

Description

@mantepse

Steps To Reproduce

sage: p = PlanePartitions(4).an_element(); p
Plane partition [[4]]
sage: hash(p)
Traceback (most recent call last):
...
TypeError: unhashable type: 'list'

Expected Behavior

sage: p = PlanePartitions(4).an_element()
sage: hash(p)

should return a hash.

Actual Behavior

A TypeError is raised.

Additional Information

Plane partitions inherit from ClonableArray, but the elements of the array are lists, eg.:

    def __init__(self, parent, pp, check=True):
...
        if isinstance(pp, PlanePartition):
            ClonableArray.__init__(self, parent, pp, check=False)
        else:
            pp = [list(_) for _ in pp]
            if pp:
                for i in reversed(range(len(pp))):
                    while pp[i] and not pp[i][-1]:
                        del pp[i][-1]
                    if not pp[i]:
                        pp.pop(i)
            ClonableArray.__init__(self, parent, pp, check=check)
...

Environment

irrelevant.

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions