• Kirill Smelkov's avatar
    *: dict.keys() returns sequence, not [] on py3 · 7851a964
    Kirill Smelkov authored
    The sequence cannot be randomly accessed, e.g.
    
        In [5]: d = {1:2}
    
        In [6]: kv = d.keys()
    
        In [7]: kv
        Out[7]: dict_keys([1])
    
        In [8]: kv[0]
        ---------------------------------------------------------------------------
        TypeError                                 Traceback (most recent call last)
        <ipython-input-8-643f90e1910b> in <module>()
        ----> 1 kv[0]
    
        TypeError: 'dict_keys' object is not subscriptable
    
    -> Use list(dict.keys()) in places where we need random access.
    7851a964
Name
Last commit
Last update
zodbtools Loading commit data...
.gitignore Loading commit data...
CHANGELOG.rst Loading commit data...
COPYING Loading commit data...
LICENSE-ZPL.txt Loading commit data...
MANIFEST.in Loading commit data...
README.rst Loading commit data...
setup.py Loading commit data...
tox.ini Loading commit data...