planetarypy / pvl

Python implementation of PVL (Parameter Value Language)
BSD 3-Clause "New" or "Revised" License
19 stars 19 forks source link

items is not subscriptable in python3 #24

Closed percurnicus closed 7 years ago

percurnicus commented 7 years ago

As pointed out in #23, in python3 items() returns an ItemsView object which is not subscriptable

In [1]: import pvl

In [2]: label = pvl.loads("""
   ...:     foo = bar
   ...:     monty = python
   ...: """)

In [3]: items = label.items()

In [4]: items[0]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-95f461411437> in <module>()
----> 1 items[0]

TypeError: 'ItemsView' object does not support indexing

But we should get something similar to:

In [4]: items[0]
Out [4]: ('foo', 'bar')