Lichen

Annotated lib/__builtins__/core.py

121:fe65f4aa1f90
2016-10-23 Paul Boddie Introduced the special get_using function.
paul@6 1
#!/usr/bin/env python
paul@6 2
paul@6 3
"""
paul@6 4
Core objects.
paul@6 5
paul@107 6
Copyright (C) 2015, 2016 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
class object:
paul@107 23
paul@107 24
    "The root class of all objects except functions."
paul@107 25
paul@6 26
    def __init__(self):
paul@6 27
        "No-operation."
paul@6 28
        pass
paul@107 29
paul@6 30
    def __bool__(self):
paul@6 31
        "Objects are true by default."
paul@6 32
        return True
paul@6 33
paul@107 34
class function:
paul@107 35
paul@107 36
    """
paul@107 37
    The class of all function objects.
paul@107 38
    Note that as a special case, function does not inherit from object.
paul@107 39
    """
paul@107 40
paul@6 41
    def __init__(self):
paul@6 42
paul@107 43
        """
paul@107 44
        Reserve special attributes for function instances.
paul@107 45
        """
paul@6 46
paul@6 47
        self.__fn__ = None
paul@6 48
        self.__args__ = None
paul@6 49
paul@107 50
    def __bool__(self):
paul@107 51
        "Functions are true by default."
paul@107 52
        return True
paul@107 53
paul@6 54
class type(object):
paul@107 55
paul@107 56
    "The class of all classes."
paul@107 57
paul@6 58
    pass
paul@6 59
paul@6 60
class BaseException(object): pass
paul@6 61
class Exception(BaseException): pass
paul@6 62
class Warning(object): pass
paul@6 63
paul@121 64
def get_using(callable, instance): pass
paul@121 65
paul@6 66
# vim: tabstop=4 expandtab shiftwidth=4