[sage-devel] Re: Set reorders elements

2009-11-08 Thread Florent Hivert
Hi > I think the design problem comes from the fact the "category of > enumerated sets" is not real "category" from the mathematical point of > view, although you can embed it inside the category of totally ordered > sets with the "enumeration order", that point of view might solve some > o

[sage-devel] Re: Set reorders elements

2009-11-08 Thread Carlo Hamalainen
On Sun, Nov 8, 2009 at 2:01 PM, Gonzalo Tornaria wrote: > This doesn't happen in "sage -python", but it does happen in "sage > -ipython", so I guess is ipython related. However, both versions seem > to be using ipython 9.1... This is the pprint (pretty print) module. From ipython's man page: -[

[sage-devel] Re: Set reorders elements

2009-11-08 Thread Gonzalo Tornaria
On Sun, Nov 8, 2009 at 2:29 AM, Alex Ghitza wrote: > > > This is a bit disconcerting: > > sage: Set(['a', 'b', 'c']) > {'a', 'c', 'b'} I am surprised by the following: sage: s = set(['a', 'b', 'c']) sage: repr(s) "set(['a', 'c', 'b'])" sage: str(s) "set(['a', 'c', 'b'])" s

[sage-devel] Re: Set reorders elements

2009-11-08 Thread javier
Hi there, On Nov 8, 9:36 am, Florent Hivert wrote: > There are some design questions which prevented me to do it at first. Let's > start with the simple one: > >  - on mathematical sets we have the notion of intersection, union, symmetric > difference. When dealing with EnumeratedSets, does some

[sage-devel] Re: Set reorders elements

2009-11-08 Thread Florent Hivert
Hi Alex, By the way, I think this is a good moment to advertise for a very good idea Nicolas had a few years ago, that is to implement and use the very common and basic notion of family: A Family is an associative container which models a family `(f_i)_{i in I}`. Then, f[i]

[sage-devel] Re: Set reorders elements

2009-11-08 Thread Florent Hivert
Hi there, > And another example, where I (would like to) follow the example of the > constructor for multivariate polynomials: > > sage: FreeGroup('x', 10) > Expected: > Free Group on the Set {x0, x1, x2, x3, x4, x5, x6, x7, x8, x9} > Got: > Free Group on the Set {x8, x9, x2, x

[sage-devel] Re: Set reorders elements

2009-11-07 Thread Nick Alexander
> sage: G. = FreeGroup() > sage: G > Free Group on the Set {a, c, b} > sage: b > c > > This is probably due more to crappy programming on my part rather than > the Set issue, but the latter did confuse me. I think this is due to a poor definition: the decision was made that variables are named

[sage-devel] Re: Set reorders elements

2009-11-07 Thread William Stein
On Sat, Nov 7, 2009 at 8:29 PM, Alex Ghitza wrote: > > > This is a bit disconcerting: > > sage: Set(['a', 'b', 'c']) > {'a', 'c', 'b'} > sage: Set(['a', 'b', 'c', 'd']) > {'a', 'c', 'b', 'd'} > sage: Set(['a', 'b', 'c', 'd', 'e']) > {'a', 'c', 'b', 'e', 'd'} > > Bug?  It doesn't seem to happen wi

[sage-devel] Re: Set reorders elements

2009-11-07 Thread Alex Ghitza
On Sat, Nov 07, 2009 at 08:44:11PM -0800, Nick Alexander wrote: > > > Sets are unordered. Why does the display order changing worry you? > Of course they are. So mathematically speaking everything is fine. However, unless there's a good reason for Set(['a', 'b', 'c']) to result in {'a', 'c',

[sage-devel] Re: Set reorders elements

2009-11-07 Thread Nick Alexander
On 7-Nov-09, at 8:29 PM, Alex Ghitza wrote: > > > This is a bit disconcerting: > > sage: Set(['a', 'b', 'c']) > {'a', 'c', 'b'} > sage: Set(['a', 'b', 'c', 'd']) > {'a', 'c', 'b', 'd'} > sage: Set(['a', 'b', 'c', 'd', 'e']) > {'a', 'c', 'b', 'e', 'd'} > > Bug? It doesn't seem to happen with lis