Why does built-in set not take keyword arguments?

Steven Watanabe Steven.Watanabe at autodesk.com
Thu May 4 20:08:30 CEST 2006

I'm trying to do something like this in Python 2.4.3:

class NamedSet(set):
  def __init__(self, items=(), name=''):
    set.__init__(self, items)
    self.name = name

class NamedList(list):
  def __init__(self, items=(), name=''):
    list.__init__(self, items)
    self.name = name

I can do:

>>> mylist = NamedList(name='foo')

but I can't do:

>>> myset = NamedSet(name='bar')
TypeError: set() does not take keyword arguments

How come? How would I achieve what I'm trying to do?

More information about the Python-list mailing list