2012-07-01 45 views
2

的ValuesView,什麼是錯用下面的代碼:索引鑑於<a href="http://stutzbachenterprises.com/blist/sorteddict.html" rel="nofollow">documentation</a>一個sorteddict

import blist 
d = blist.sorteddict({3: "first", 7: "second"}) 
print(d.keys()[1]) 
print(d.values()[1]) 
print(d.items()[1]) 

它打印

Traceback (most recent call last): 
    File "test.py", line 4, in <module> 
    print(d.values()[1]) 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/_sorteddict.py", line 53, in __getitem__ 
    key = self._mapping.sortedkeys[index] 
AttributeError: 'sorteddict' object has no attribute 'sortedkeys' 
+0

啊!它看起來像一個blist中的bug。我想我應該報告它? –

回答

3

這似乎是一個錯誤。代碼沒問題。

相關問題