Lichen

Annotated lib/operator/sequence.py

920:b4b4179c39f2
2021-06-22 Paul Boddie Renamed the int class to integer and introduced an int function. int-as-function
paul@6 1
#!/usr/bin/env python
paul@6 2
paul@6 3
"""
paul@6 4
Operator support.
paul@6 5
paul@548 6
Copyright (C) 2010, 2013, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
paul@6 7
paul@6 8
This program is free software; you can redistribute it and/or modify it under
paul@6 9
the terms of the GNU General Public License as published by the Free Software
paul@6 10
Foundation; either version 3 of the License, or (at your option) any later
paul@6 11
version.
paul@6 12
paul@6 13
This program is distributed in the hope that it will be useful, but WITHOUT
paul@6 14
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
paul@6 15
FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
paul@6 16
details.
paul@6 17
paul@6 18
You should have received a copy of the GNU General Public License along with
paul@6 19
this program.  If not, see <http://www.gnu.org/licenses/>.
paul@6 20
"""
paul@6 21
paul@6 22
# Access and slicing functions.
paul@6 23
paul@548 24
def delitem(a, b):
paul@548 25
    a.__delitem__(b)
paul@548 26
paul@6 27
def getitem(a, b):
paul@6 28
    return a.__getitem__(b)
paul@6 29
paul@6 30
def setitem(a, b, c):
paul@6 31
    a.__setitem__(b, c)
paul@6 32
paul@548 33
def delslice(a, b, c):
paul@548 34
    a.__delitem__(slice(b, c))
paul@548 35
paul@6 36
def getslice(a, b, c):
paul@6 37
    return a.__getitem__(slice(b, c))
paul@6 38
paul@6 39
def setslice(a, b, c, d):
paul@6 40
    a.__setitem__(slice(b, c), d)
paul@6 41
paul@6 42
# vim: tabstop=4 expandtab shiftwidth=4