orderedstuf lacks fromkeys method

Issue #5 resolved
Jonathan Eunice created an issue
>>> from stuf import stuf, orderedstuf
>>> from collections import OrderedDict
>>> for m in [dict, stuf, OrderedDict, orderedstuf]:
...     print m, 'fromkeys' in dir(m)
...
<type 'dict'> True
<class 'stuf.core.stuf'> True
<class 'collections.OrderedDict'> True
<class 'stuf.core.orderedstuf'> False

This issue holds across 2.6, 2.7 and 3.4. The collections.OrderedDict and ordereddict.OrderedDict classes upon which orderedstuf presumably depend do have fromkeys methods.

I am able to work around this with:

class ostuf(orderedstuf):
    @classmethod
    def fromkeys(cls, keys, values=None):
        values = values or [ None ] * len(keys)
        return cls(zip(keys, values))

But it would be nice for orderedstuf to support all of the regular dict or stuf methods.

Comments (2)

  1. Log in to comment