mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Added itemgetter and attrgetter to operator.
This commit is contained in:
parent
e04489e18a
commit
b9483aee3b
@ -149,6 +149,15 @@ def rsplit(s, sep=None, maxsplit=-1):
|
||||
L.reverse()
|
||||
return [s[::-1] for s in L]
|
||||
|
||||
import operator
|
||||
def itemgetter(i):
|
||||
return lambda x: x[i]
|
||||
|
||||
def attrgetter(attr):
|
||||
return lambda x: getattr(x, attr)
|
||||
operator.itemgetter = itemgetter
|
||||
operator.attrgetter = attrgetter
|
||||
|
||||
for name in exported:
|
||||
__builtins__[name] = globals()[name]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user