mirror of https://github.com/mahmoud/boltons.git
dictutils passes on Python 3
This commit is contained in:
parent
69ef72d51c
commit
71ae1e5f38
|
@ -34,9 +34,13 @@ thanks to `Mark Williams`_ for all his help.
|
|||
.. _Mark Williams: https://github.com/markrwilliams
|
||||
"""
|
||||
|
||||
from itertools import izip
|
||||
from collections import KeysView, ValuesView, ItemsView
|
||||
|
||||
try:
|
||||
from itertools import izip
|
||||
except ImportError:
|
||||
izip = zip # Python 3
|
||||
|
||||
try:
|
||||
from compat import make_sentinel
|
||||
_MISSING = make_sentinel(var_name='_MISSING')
|
||||
|
@ -445,7 +449,7 @@ class OrderedMultiDict(dict):
|
|||
tuple), so the recommended signature looks like:
|
||||
|
||||
>>> omd = OrderedMultiDict(zip('hello', 'world'))
|
||||
>>> omd.sorted(key=lambda (k, v): v) # note parens around (k, v)
|
||||
>>> omd.sorted(key=lambda i: i[1]) # i[0] is the key, i[1] is the val
|
||||
OrderedMultiDict([('o', 'd'), ('l', 'l'), ('e', 'o'), ('h', 'w')])
|
||||
"""
|
||||
cls = self.__class__
|
||||
|
|
Loading…
Reference in New Issue