1.1 --- a/lib/operator.py Sun Sep 05 02:20:05 2010 +0200
1.2 +++ b/lib/operator.py Sun Sep 05 21:14:40 2010 +0200
1.3 @@ -220,4 +220,20 @@
1.4 def ne(a, b):
1.5 return binary_op(a, b, lambda a: a.__ne__, lambda b: b.__ne__)
1.6
1.7 +# Access and slicing functions.
1.8 +
1.9 +def getitem(a, b):
1.10 + return a.__getitem__(b)
1.11 +
1.12 +def setitem(a, b, c):
1.13 + a.__setitem__(b, c)
1.14 +
1.15 +# NOTE: Should be able to optimise temporary instance allocations for slices.
1.16 +
1.17 +def getslice(a, b, c):
1.18 + return a.__getitem__(slice(b, c))
1.19 +
1.20 +def setslice(a, b, c, d):
1.21 + a.__setitem__(slice(b, c), d)
1.22 +
1.23 # vim: tabstop=4 expandtab shiftwidth=4