Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds FiniteEnumeratedSet #7403

Closed
nthiery opened this issue Nov 6, 2009 · 5 comments
Closed

adds FiniteEnumeratedSet #7403

nthiery opened this issue Nov 6, 2009 · 5 comments

Comments

@nthiery
Copy link
Contributor

nthiery commented Nov 6, 2009

This patch adds sage.sets.finite_enumerated_set.FiniteEnumeratedSet

depends on #5891

CC: @sagetrac-sage-combinat

Component: combinatorics

Keywords: finite enumerated sets

Author: Florent Hivert

Reviewer: Nicolas M. Thiéry

Merged: sage-4.3.alpha0

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

@nthiery
Copy link
Contributor Author

nthiery commented Nov 6, 2009

@nthiery
Copy link
Contributor Author

nthiery commented Nov 6, 2009

Attachment: trac_7403-finite-enumeratedsets-fh.patch.gz

Apply only this one (ignore the next one)

@hivert
Copy link

hivert commented Nov 9, 2009

comment:3

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

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

I'm re-uploading a patch with the following folded in

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

@hivert
Copy link

hivert commented Nov 9, 2009

comment:4

Attachment: trac_7403-finite-enumeratedsets-fh.3.patch.gz

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

@mwhansen
Copy link
Contributor

Merged: sage-4.3.alpha0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants