Aahz wrote: > 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.
You're right, sets should really have a separate base class. However, in reality they behave mostly like dictionaries using (and hiding) a common value of all 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. basestring is an abstract class in the sense that it doesn't provide any interface on its own. I guess the others should use the same approach. They are usually only used for quickly checking for an interface or "type property". Note that unicode and strings don't share a common implementation either - they just happen to expose a rather similar interface. > (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. ;-) Not sure about others. I rarely read c.l.p. Even pydev has enough traffic these days to require filtering. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Dec 21 2005) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com