12.11.17 12:06, Nick Coghlan пише: > So if folks would like dict unpacking syntax, then a suitable place to > start would be a proposal for a "getitems" builtin that allowed > operations like: > > b, a = getitems(d, ("b", "a")) > > operator.itemgetter and operator.attrgetter may provide some > inspiration for possible proposals. I don't see any relations between this getitems and operator.itemgetter or operator.attrgetter. getitems can be implemented as: (the most obvious way) def getitems(mapping, keys): for key in keys: yield mapping[key] or def getitems(mapping, keys): return map(functools.partial(operator.getitem, mapping), keys) or (simpler but rough equivalent) def getitems(mapping, keys): return map(mapping.__getitem__, keys)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4