Python 3: dict & dict.keys()
rosuav at gmail.com
Thu Jul 25 10:02:11 CEST 2013
On Thu, Jul 25, 2013 at 5:04 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> - Views support efficient (O(1) in the case of keys) membership testing,
> which neither iterkeys() nor Python2 keys() does.
To save me the trouble and potential error of digging through the
source code: What's the complexity of membership testing on
values/items? Since you're calling it "efficient" it must be better
than O(n) which the list form would be, yet it isn't O(1) or you
wouldn't have qualified "in the case of keys". Does this mean
membership testing of the values and items views is O(log n) in some
way, eg a binary search?
More information about the Python-list