[Python-bugs-list] [ python-Bugs-663701 ] sets module review

SourceForge.net noreply@sourceforge.net
Tue, 07 Jan 2003 14:44:52 -0800


Bugs item #663701, was opened at 2003-01-07 09:08
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=663701&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Sebastien Keim (s_keim)
Assigned to: Nobody/Anonymous (nobody)
Summary: sets module review

Initial Comment:
* the ^ operator doesnt print well in pdf generated
documentation (both in what's new and in library reference)

* shouldn't the _as_immutable and
_as_temporaly_immutable be spelled __as_immutable__ and
__as_temporaly_immutable__ for consistency with other
hook methods?

* cmp() suck:
<pre>
bash-2.05$ ./python 
Python 2.3a1 (#1, Jan  4 2003, 10:17:56) 
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import sets
>>> s = sets.Set
>>> a = s([0])
>>> b = s([1])
>>> cmp(a,b)
1
>>> 
bash-2.05$ ./python 
Python 2.3a1 (#1, Jan  4 2003, 10:17:56) 
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import sets
>>> a=sets.Set([0])
>>> b=sets.Set([1])
>>> cmp(a,b)
-1
</pre>

* Because we can have set1!=set2 and both
(set1<set2)==False and (set2<set1)==False what will be
the behavhior of: [set1, set2].sort().
Since inclusion can't  define a full ordering relation,
wouldn't it be better to remove the equivalence between
issubset and __lt__ (and other comparaison methods) and
to use an equivalent to the dictionary protocol to
define the < and > behavior?




----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2003-01-07 17:44

Message:
Logged In: YES 
user_id=593130

If/when sets become builtin, would type object be 
called 'set' or break current convention by being 
called 'Set'?  If the former, I think classSet should be 'set' 
now so one can write 'from sets import set' and have rest 
of code ready for the future.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=663701&group_id=5470