Lichen

lib/__builtins__/__init__.py

489:a89ee0f5895d
2017-01-21 Paul Boddie Made class and function instance __name__ attributes leafnames, introducing a separate __mname__ attribute on classes and function instances to help support the reproduction of the full path of those objects. Updated the visitor example to use the __name__ attributes of node classes instead of special name attributes.
     1 #!/usr/bin/env python     2      3 """     4 Simple built-in classes and functions.     5      6 Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>     7      8 This program is free software; you can redistribute it and/or modify it under     9 the terms of the GNU General Public License as published by the Free Software    10 Foundation; either version 3 of the License, or (at your option) any later    11 version.    12     13 This program is distributed in the hope that it will be useful, but WITHOUT    14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    15 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more    16 details.    17     18 You should have received a copy of the GNU General Public License along with    19 this program.  If not, see <http://www.gnu.org/licenses/>.    20 """    21     22 from __builtins__.core import (    23     function, get_using, module, object, type,    24     ArithmeticError, Exception, FloatingPointError, MemoryError, OverflowError,    25     TypeError, UnboundMethodInvocation, ZeroDivisionError    26     )    27     28 # Exceptions.    29     30 from __builtins__.exception import (    31     AssertionError,    32     AttributeError,    33     EOFError,    34     EnvironmentError,    35     IndentationError,    36     IndexError,    37     IOError,    38     KeyError,    39     KeyboardInterrupt,    40     NotImplementedError,    41     OSError,    42     RuntimeError,    43     StopIteration,    44     SyntaxError,    45     SystemError,    46     SystemExit,    47     TabError,    48     UnicodeDecodeError,    49     UnicodeEncodeError,    50     UnicodeError,    51     UnicodeTranslateError,    52     ValueError    53     )    54     55 # Classes.    56     57 from __builtins__.boolean import bool, False, True    58 from __builtins__.buffer import buffer    59 from __builtins__.complex import complex    60 from __builtins__.dict import dict    61 from __builtins__.file import file    62 from __builtins__.float import float    63 from __builtins__.int import int    64 from __builtins__.span import range, slice, xrange    65 from __builtins__.iterator import itemiterator    66 from __builtins__.list import list    67 from __builtins__.long import long    68 from __builtins__.none import None, NoneType    69 from __builtins__.notimplemented import NotImplemented, NotImplementedType    70 from __builtins__.set import frozenset, set    71 from __builtins__.str import basestring, str, string    72 from __builtins__.tuple import tuple    73 from __builtins__.unicode import unicode, utf8string    74     75 # Functions.    76     77 from __builtins__.attribute import getattr, hasattr, setattr    78 from __builtins__.character import chr, hex, oct, ord, unichr    79 from __builtins__.comparable import cmp, hash    80 from __builtins__.identity import callable, id, isinstance, issubclass, repr    81 from __builtins__.io import open, raw_input, print_    82 from __builtins__.iterable import all, any, enumerate, filter, iter, len, map, max, min, reduce, reversed, sorted, sum, zip    83 from __builtins__.namespace import dir, globals, locals, vars    84 from __builtins__.numeric import abs, divmod, pow, round    85     86 # vim: tabstop=4 expandtab shiftwidth=4