Inheriting from OrderedDict causes problem
Bruce Eckel
lists.eckel at gmail.com
Wed Feb 22 12:33:12 EST 2012
More information about the Python-list mailing list
Wed Feb 22 12:33:12 EST 2012
- Previous message (by thread): Inheriting from OrderedDict causes problem
- Next message (by thread): Python math is off by .000000000000045
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Feb 22, 10:10 am, Peter Otten <__pete... at 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 in stuff: > ... self[k] = v > ...>>> X([("a", "b"), ("c", "d")]) > > X([('a', 'b'), ('c', 'd')]) Thank you! That worked. Languages. Some of them automatically call the default base-class constructors, others don't. Apparently.
- Previous message (by thread): Inheriting from OrderedDict causes problem
- Next message (by thread): Python math is off by .000000000000045
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list