Lichen

Change of lib/__builtins__/core.py

107:3fe37462e0f6
lib/__builtins__/core.py
     1.1 --- a/lib/__builtins__/core.py	Mon Oct 17 15:39:07 2016 +0200
     1.2 +++ b/lib/__builtins__/core.py	Mon Oct 17 18:56:34 2016 +0200
     1.3 @@ -3,7 +3,7 @@
     1.4  """
     1.5  Core objects.
     1.6  
     1.7 -Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
     1.8 +Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     1.9  
    1.10  This program is free software; you can redistribute it and/or modify it under
    1.11  the terms of the GNU General Public License as published by the Free Software
    1.12 @@ -20,22 +20,41 @@
    1.13  """
    1.14  
    1.15  class object:
    1.16 +
    1.17 +    "The root class of all objects except functions."
    1.18 +
    1.19      def __init__(self):
    1.20          "No-operation."
    1.21          pass
    1.22 +
    1.23      def __bool__(self):
    1.24          "Objects are true by default."
    1.25          return True
    1.26  
    1.27 -class function(object):
    1.28 +class function:
    1.29 +
    1.30 +    """
    1.31 +    The class of all function objects.
    1.32 +    Note that as a special case, function does not inherit from object.
    1.33 +    """
    1.34 +
    1.35      def __init__(self):
    1.36  
    1.37 -        # Reserve special attributes for function instances.
    1.38 +        """
    1.39 +        Reserve special attributes for function instances.
    1.40 +        """
    1.41  
    1.42          self.__fn__ = None
    1.43          self.__args__ = None
    1.44  
    1.45 +    def __bool__(self):
    1.46 +        "Functions are true by default."
    1.47 +        return True
    1.48 +
    1.49  class type(object):
    1.50 +
    1.51 +    "The class of all classes."
    1.52 +
    1.53      pass
    1.54  
    1.55  class BaseException(object): pass