Re: Inheriting from OrderedDict causes problem

2012-02-22 Thread Bruce Eckel
On Feb 22, 10:10 am, Peter Otten <__pete...@web.de> wrote: > Looks like invoking OrderedDict.__init__() is necessary: > > >>> from collections import OrderedDict > >>> class X(OrderedDict): > > ...     def __init__(self, stuff): > ...             super(X, self).__init__() > ...             for k, v

Re: Inheriting from OrderedDict causes problem

2012-02-22 Thread Peter Otten
Bruce Eckel wrote: > Notice that both classes are identical, except that one inherits from > dict (and works) and the other inherits from OrderedDict and fails. > Has anyone seen this before? Thanks. > > import collections > > class Y(dict): > def __init__(self, stuff): > for k, v in

Inheriting from OrderedDict causes problem

2012-02-22 Thread Bruce Eckel
Notice that both classes are identical, except that one inherits from dict (and works) and the other inherits from OrderedDict and fails. Has anyone seen this before? Thanks. import collections class Y(dict): def __init__(self, stuff): for k, v in stuff: self[k] = v # Thi