On Tue, Jun 12, 2012 at 9:56 AM, tvn <[email protected]> wrote:
> Does Sage has some data structure like set that preserve the order of the
> elements ? For example , I want set([1,2,3,1) to always return 1,2,3 . In
> addition to set(), I also need operations of set like difference,
> intersection ,etc that guarantees some specific orders. Thanks,
If you just care about order when iterating, use sorted:
for x in sorted(set([1,2,3,1])):
print x
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org