On Thu, Mar 27, 2014 at 1:32 AM, Ian Kelly <[email protected]> wrote:
> On Tue, Mar 25, 2014 at 7:36 AM, Steven D'Aprano
> <[email protected]> wrote:
>> Yes, Python could have changed the meaning of {} to mean the empty set.
>> But you know what? The empty set is not that important. Sets are not
>> fundamental to Python. Python didn't even have sets until 2.3, and at
>> first they were just a standard library module, not even built-in. Dicts,
>> on the other hand, are fundamental to Python. They are used everywhere.
>> Python is, in a very real sense, built on dicts, not sets. You can
>> implement sets starting from dicts, but not the other way around: dicts
>> are more fundamental than sets.
>
> Challenge accepted!
Oops, I forgot to allow for a 0-argument constructor. Please revise
the SetBasedDict.__init__ method to:
def __init__(self, initial=(), **kwargs):
self._contents = set()
if initial or kwargs:
self.update(initial, **kwargs)
--
https://mail.python.org/mailman/listinfo/python-list