[Python-Dev] Sets are mappings?

Aahz aahz at pythoncraft.com
Tue Dec 20 23:31:24 CET 2005


On Tue, Dec 20, 2005, M.-A. Lemburg wrote:
> Josiah Carlson wrote:
>> 
>> New superclasses for all built-in types (except for string and unicode,
>> which already subclass from basestring).
>> 
>> int, float, complex (long) : subclass from basenumber
>> tuple, list, set : subclass from basesequence
>> dict : subclass from basemapping
> 
> set should be under basemapping.

Are you sure?  Sets are not actually a mapping; they consist only of
keys.  The Python docs do not include sets under maps, and sets do not
support some of the standard mapping methods (notably keys()).  Raymond
Hettinger has also talked about switching to a different internal
structure for sets.

(Should this discussion move to c.l.py?  Normally I'd think so, but I
think it's critical that the core developers agree about this.  It's
also critical for me to know because I'm writing a book, but that's not
reason enough to stick with python-dev. ;-)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Don't listen to schmucks on USENET when making legal decisions.  Hire
yourself a competent schmuck."  --USENET schmuck (aka Robert Kern)


More information about the Python-Dev mailing list