operators and datatypes for sets
Anton Vredegoor
anton at vredegoor.doge.nl
Thu Apr 26 19:31:39 EDT 2001
On Tue, 24 Apr 2001 16:24:18 +0200, "Alex Martelli"
<aleaxit at yahoo.com> wrote:
>"Anton Vredegoor" <a.vredegoor at hccnet.nl> wrote in message
>news:9c3v5i$k7o$1 at news.hccnet.nl...
>> Doesn't it feel right? :-)
>
>Not to this reader. I would rather expect from this that
>s2 is a set that may contain other sets as members, and
>that the code is testing to see whether set s1 is such a
>set-member of s2.
I have made a new version wherein I made some changes according to
your and Steve Holdens suggestions, and I have also conformed a bit in
the direction of what I perceived to be the consensus at python-DEV.
>If any language-specific operator syntax was being extended
>to test for "is-subset-of", I would expect to use < and <=
>(look like the normal math notation for proper-subclass and
>subclass, which do define a partial order). But I think
>s2.has_subset(s1) and.or s1.is_subset_of(s2) might be more
>readable and less accident-prone.
>
I have used s1.has_subset(s2), which seemed more popular at
python-DEV.
Next I am going to think about sets in sets which is a lot more
difficult to program.
please have look at:
http://home.hccnet.nl/a.vredegoor/universe/universe.py
or the html version:
http://home.hccnet.nl/a.vredegoor/universe/universe.html
And let me know what you think about it.
Anton.
>Alex
>
More information about the Python-list
mailing list