Do we have multiset?

117 views
Skip to first unread message

Kwankyu

unread,
Jun 25, 2011, 5:26:57 PM6/25/11
to sage-s...@googlegroups.com
Hi,

Do we have multiset in Sage or Python? I learned that Python 2.7 has Counter collection which implements multiset.

If not, is there a simple construct to mimic multiset?


Kwankyu

Rado

unread,
Jun 26, 2011, 1:04:25 AM6/26/11
to sage-s...@googlegroups.com
you can use dicts
multiset = {1: 1, 2: 4, 3: 9}

Kwankyu

unread,
Jun 26, 2011, 2:17:45 AM6/26/11
to sage-s...@googlegroups.com
Hi,

Dicts do not have methods for multisets. I will wait for Python 2.7 in Sage.


Kwankyu
Reply all
Reply to author
Forward
0 new messages