micropython

Changeset

542:b939a34d5b5c
2012-06-11 Paul Boddie raw files shortlog changelog graph Added an alternative types module implementation.
lib/types.py (file)
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/types.py	Mon Jun 11 00:40:42 2012 +0200
     1.3 @@ -0,0 +1,70 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +"""
     1.7 +Type objects.
     1.8 +
     1.9 +Copyright (C) 2012 Paul Boddie <paul@boddie.org.uk>
    1.10 +
    1.11 +This program is free software; you can redistribute it and/or modify it under
    1.12 +the terms of the GNU General Public License as published by the Free Software
    1.13 +Foundation; either version 3 of the License, or (at your option) any later
    1.14 +version.
    1.15 +
    1.16 +This program is distributed in the hope that it will be useful, but WITHOUT
    1.17 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.18 +FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    1.19 +details.
    1.20 +
    1.21 +You should have received a copy of the GNU General Public License along with
    1.22 +this program.  If not, see <http://www.gnu.org/licenses/>.
    1.23 +"""
    1.24 +
    1.25 +# Built-in type duplication.
    1.26 +
    1.27 +type = type
    1.28 +NoneType = NoneType
    1.29 +NotImplementedType = NotImplementedType
    1.30 +
    1.31 +# Synonyms for built-in types.
    1.32 +
    1.33 +BooleanType = bool
    1.34 +BufferType = buffer
    1.35 +BuiltinFunctionType = function
    1.36 +BuiltinMethodType = function
    1.37 +ComplexType = complex
    1.38 +DictType = dict
    1.39 +#EllipsisType = ellipsis
    1.40 +FileType = file
    1.41 +FloatType = float
    1.42 +FunctionType = function
    1.43 +IntType = int
    1.44 +LambdaType = function
    1.45 +ListType = list
    1.46 +LongType = long
    1.47 +MethodType = function
    1.48 +ObjectType = object
    1.49 +SliceType = slice
    1.50 +StringType = str
    1.51 +TupleType = tuple
    1.52 +UnboundMethodType = function
    1.53 +UnicodeType = unicode
    1.54 +XRangeType = xrange
    1.55 +
    1.56 +StringTypes = (StringType, UnicodeType)
    1.57 +
    1.58 +# Types without special definitions.
    1.59 +
    1.60 +ClassType = object
    1.61 +GeneratorType = object
    1.62 +InstanceType = object
    1.63 +ModuleType = object
    1.64 +TracebackType = object
    1.65 +
    1.66 +# Implementation-specific definitions not relevant to micropython.
    1.67 +
    1.68 +DictProxyType = object
    1.69 +FrameType = object
    1.70 +GetSetDescriptorType = object
    1.71 +MemberDescriptorType = object
    1.72 +
    1.73 +# vim: tabstop=4 expandtab shiftwidth=4