. -, " , ". -, , - 2/3 - 1/3.
, ( 2/3, n/2 ). , :
- 2.0n, 1.0n, 1.5n: ,
- 2.0n, 1.0n, 1.5n: ,
- 1.5n, 1.0n, 1.5n: ,
- 1.0n, 1.0n, 0.5n:
- 1.5n, 0.5n, 1.0n: , compact
- 1.5n, 0.5n, 0.5n:
, , . () , , .
, , , :
- ( /, ..).
- , "" , .
- .
- , dict ( CPython, 40% , ).
, CPython, , , " C".
, , , , - , , Python , , malloc , , , ?
PyPy, Python .
, , StackOverflow , Python. , - , python-, python-dev / . : 2.x; 3.x, - , , , . , ; Python dicts, , , , , . :
, , " " 1.0n 1.0n .
, , . "" . - . 1.0n . , , 0.5n .
, ,
" ", " ", " ". : ; ; Python; TOOWTDI ; .. , ; , - Python, . , . , , () , () , , , .
, , , , , , - , , , , Python "". , . , Python , Pythonic, , Python, .
, , , ... 'for (a, b) mydict.iteritems() iter', (...) filehandle.
"" -? , , it = iter(mydict.items()), for (a, b) in it:. , , , ? , , . . , StopIteration. list/set/dict, , . - , ?
" () , , ". , , , .
, 1.0 double 0.5. , -, n 1/3 , , -, n/2 2/3 . ?
O (1)
, , , , 0.0n , -0.5n. .
1.0n
, , , , , , . , . , , 0.5n dict, , 0.5n , , . 0.5n, 1.0n, .
, , , , , .
, . , , " /". 99% d = {k: v for k, v in d.items() if pred(k)} - . , ( " , " ) - . , , , , , , .
1,5n, .5n
, . - - , , - - . ( , - dict , , .)
: ", , " - , 1.5n 1.0n, , - .