I apologize. It was late, and my supply of patience for the day was exhausted.
def read_and_write(self):
Reader.read(self)
Writer.write(self)
That is, if you want to get at a particular superclass implementation, then you just call it directly. super() is used when you're not calling a particular superclass, instead relying on Python to compute the correct "next method" for you. def __init__(self, shapename=None, **kwds):
also allows that. def __init__(self, shapename, **kwds):
Or, in Python 3: def __init__(self, *, shapename, **kwds):
(making shapename a required keyword-only argument) >>> def init(**kwargs):
... pass
...
>>> init(shapename='circle', **{'shapename': 'circle'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: init() got multiple values for keyword argument 'shapename' class DefaultOrderedCounter(defaultdict, OrderedCounter):
pass
doc = DefaultOrderedCounter(lambda: 42)
doc.update('abracadabra')
Which results in: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python32\lib\collections.py", line 507, in update
_count_elements(self, iterable)
File "c:\python32\lib\collections.py", line 63, in __setitem__
self.__map[key] = link = Link()
AttributeError: 'DefaultOrderedCounter' object has no attribute '_OrderedDict__map'
Whoops! Apparently defaultdict doesn't use super either. Of course a better way to do this would be to subclass DefaultOrderedCounter and just override the __missing__ method by hand, but that's not the point.