Opened 13 years ago

Closed 13 years ago

## #7403 closed enhancement (fixed)

Reported by: Owned by: nthiery hivert major sage-4.3 combinatorics finite enumerated sets sage-combinat sage-4.3.alpha0 Florent Hivert Nicolas M. Thiéry

depends on #5891

### comment:1 Changed 13 years ago by nthiery

• Status changed from new to needs_review

### comment:2 Changed 13 years ago by nthiery

• Status changed from needs_review to positive_review

### Changed 13 years ago by nthiery

Apply only this one (ignore the next one)

### comment:3 Changed 13 years ago by hivert

• Status changed from positive_review to needs_work

Since it's not yet integrated, I take the chance to solve this stupid bug:

```sage: FiniteEnumeratedSet([1])
{1,}
```

```diff --git a/sage/sets/finite_enumerated_set.py b/sage/sets/finite_enumerated_set.py
--- a/sage/sets/finite_enumerated_set.py
+++ b/sage/sets/finite_enumerated_set.py
@@ -123,8 +123,13 @@ class FiniteEnumeratedSet(UniqueRepresen
sage: S = FiniteEnumeratedSet([1,2,3])
sage: repr(S)
'{1, 2, 3}'
+            sage: S = FiniteEnumeratedSet([1])
+            sage: repr(S)
+            '{1}'
"""
-        return "{"+str(self._elements)[1:-1] + '}'
+        if len(self._elements) == 1: # avoid printing '{1,}'
+            return "{" + str(self._elements[0]) + '}'
+        return "{" + str(self._elements)[1:-1] + '}'

def __contains__(self, x):
"""
```

Florent

### comment:4 Changed 13 years ago by hivert

• Status changed from needs_work to needs_review

Please Nicolas (or anyone else re-view the small change.

Only trac_7403-finite-enumeratedsets-fh.3.patch should be applied on top of #5891

Cheers,

Florent

### comment:5 Changed 13 years ago by nthiery

• Status changed from needs_review to positive_review

### comment:6 Changed 13 years ago by hivert

• Owner changed from mhansen to hivert

### comment:7 Changed 13 years ago by mhansen

• Merged in set to sage-4.3.alpha0
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.