Opened 8 years ago

Closed 8 years ago

# Set Partitions, either a bug or something is unclear.

Reported by: Owned by: startakovsky tbd major sage-duplicate/invalid/wontfix combinatorics Ben Salisbury N/A

Consider the following code. The first is an example of not being able to verify the type Set Partition, the second is an analogous example with Permutations. Please advise on this discrepancy and how to get around it.

```sage: sp = SetPartitions(5).random_element()
sage: sp
{{5}, {2, 3}, {1, 4}}
sage: type(sp)
<class 'sage.sets.set.Set_object_enumerated_with_category'>
sage: type(sp) == Set_object_enumerated_with_category
----------------------------------------------- NameError
Traceback (most recent call last)
NameError: name  'Set_object_enumerated_with_category' is not defined

sage: p = Permutations(5).random_element()
sage: p
(1,4,3,5,2)
sage: type(p)
<class 'sage.combinat.permutation.Permutation_class'>
sage: type(p) == Permutation_class
True
```

### comment:1 Changed 8 years ago by tscrim

• Component changed from PLEASE CHANGE to combinatorics
• Description modified (diff)
• Milestone changed from sage-5.9 to sage-duplicate/invalid/wontfix
• Status changed from new to needs_review
• Type changed from PLEASE CHANGE to defect

This is taken care of by #14140:

```sage: sp = SetPartitions(5).random_element(); sp
{{1, 4}, {2, 5}, {3}}
sage: type(sp)
sage.combinat.set_partition.SetPartitions_set_with_category.element_class
sage: sp.parent()
Set partitions of {1, 2, 3, 4, 5}
```

There were two problems:

1. The underlying/central problem was that there was no specified element class before #14140.
1. The `Set_object_enumerated` class (which is a subclass of `Parent`) is changed by the category framework into the `with_category` class which doesn't exist as code. There's also the fact that permutations are not yet in the category framework.

Hope that clarifies some things.

Last edited 8 years ago by tscrim (previous) (diff)

(cc me)

### comment:3 Changed 8 years ago by bsalisbury1

• Reviewers set to Ben Salisbury
• Status changed from needs_review to positive_review

### comment:4 Changed 8 years ago by jdemeyer

• Resolution set to duplicate
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.