[nylug-talk] Python programming question

Michael Bacarella mbac at netgraft.com
Wed Feb 28 21:14:48 EST 2007


Thought I'd pick the list-brain a bit.

Given:

v = {}
for i  in xrange(0,20000000):
    v[i] = 1

Is calling keys() on v an expensive O(n) kind of operation, or more like 
a cheap O(1) operation?

--
Michael Bacarella <mbac at netgraft.com>

1-646-641-8662 (cell)

545 Eighth Avenue  Suite 401
New York, NY 10018

http://michael.bacarella.com/
http://netgraft.com/


More information about the nylug-talk mailing list