"types" — Names for built-in types
**********************************

**ソースコード:** Lib/types.py

======================================================================

This module defines names for some object types that are used by the
standard Python interpreter, but not for the types defined by various
extension modules. Also, it does not include some of the types that
arise during processing such as the "listiterator" type. It is safe to
use "from types import *" — the module does not export any names
besides the ones listed here. New names exported by future versions of
this module will all end in "Type".

Typical use is for functions that do different things depending on
their argument types, like the following:

   from types import *
   def delete(mylist, item):
       if type(item) is IntType:
          del mylist[item]
       else:
          mylist.remove(item)

Starting in Python 2.2, built-in factory functions such as "int()" and
"str()" are also names for the corresponding types.  This is now the
preferred way to access the type instead of using the "types" module.
Accordingly, the example above should be written as follows:

   def delete(mylist, item):
       if isinstance(item, int):
          del mylist[item]
       else:
          mylist.remove(item)

The module defines the following names:

types.NoneType

   The type of "None".

types.TypeType

   The type of type objects (such as returned by "type()"); alias of
   the built-in "type".

types.BooleanType

   The type of the "bool" values "True" and "False"; alias of the
   built-in "bool".

   バージョン 2.3 で追加.

types.IntType

   The type of integers (e.g. "1"); alias of the built-in "int".

types.LongType

   The type of long integers (e.g. "1L"); alias of the built-in
   "long".

types.FloatType

   The type of floating point numbers (e.g. "1.0"); alias of the
   built-in "float".

types.ComplexType

   The type of complex numbers (e.g. "1.0j").  This is not defined if
   Python was built without complex number support.

types.StringType

   The type of character strings (e.g. "'Spam'"); alias of the built-
   in "str".

types.UnicodeType

   The type of Unicode character strings (e.g. "u'Spam'").  This is
   not defined if Python was built without Unicode support.  It’s an
   alias of the built-in "unicode".

types.TupleType

   The type of tuples (e.g. "(1, 2, 3, 'Spam')"); alias of the built-
   in "tuple".

types.ListType

   The type of lists (e.g. "[0, 1, 2, 3]"); alias of the built-in
   "list".

types.DictType

   The type of dictionaries (e.g. "{'Bacon': 1, 'Ham': 0}"); alias of
   the built-in "dict".

types.DictionaryType

   An alternate name for "DictType".

types.FunctionType
types.LambdaType

   The type of user-defined functions and functions created by
   "lambda" expressions.

types.GeneratorType

   The type of *generator*-iterator objects, produced by calling a
   generator function.

   バージョン 2.2 で追加.

types.CodeType

   "compile()" 関数が返すようなコードオブジェクトの型です。

types.ClassType

   The type of user-defined old-style classes.

types.InstanceType

   The type of instances of user-defined old-style classes.

types.MethodType

   ユーザー定義のクラスのインスタンスのメソッドの型です。

types.UnboundMethodType

   An alternate name for "MethodType".

types.BuiltinFunctionType
types.BuiltinMethodType

   "len()" や "sys.exit()" のような組み込み関数や、組み込み型のメソッ
   ドの型です。 (ここでは 「組み込み」 という単語を 「Cで書かれた」 と
   いう意味で使っています)

types.ModuleType

   The type of modules.

types.FileType

   The type of open file objects such as "sys.stdout"; alias of the
   built-in "file".

types.XRangeType

   The type of range objects returned by "xrange()"; alias of the
   built-in "xrange".

types.SliceType

   The type of objects returned by "slice()"; alias of the built-in
   "slice".

types.EllipsisType

   The type of "Ellipsis".

types.TracebackType

   The type of traceback objects such as found in "sys.exc_traceback".

types.FrameType

   フレームオブジェクトの型です。トレースバックオブジェクト "tb" の
   "tb.tb_frame" などです。

types.BufferType

   The type of buffer objects created by the "buffer()" function.

types.DictProxyType

   The type of dict proxies, such as "TypeType.__dict__".

types.NotImplementedType

   The type of "NotImplemented"

types.GetSetDescriptorType

   "FrameType.f_locals" や "array.array.typecode" のような、拡張モジュ
   ールにおいて "PyGetSetDef" によって定義されたオブジェクトの型です。
   この型はオブジェクト属性のディスクリプタとして利用されます。
   "property" 型と同じ目的を持った型ですが、こちらは拡張モジュールで定
   義された型のためのものです。

   バージョン 2.5 で追加.

types.MemberDescriptorType

   "datetime.timedelta.days" のような、拡張モジュールにおいて
   "PyMemberDef" によって定義されたオブジェクトの型です。この型は、標
   準の変換関数を利用するような、Cのシンプルなデータメンバで利用されま
   す。 "property" 型と同じ目的を持った型ですが、こちらは拡張モジュー
   ルで定義された型のためのものです。

   Pythonの他の実装では、この型は "GetSetDescriptorType" と同じかもし
   れません。

   バージョン 2.5 で追加.

types.StringTypes

   A sequence containing "StringType" and "UnicodeType" used to
   facilitate easier checking for any string object.  Using this is
   more portable than using a sequence of the two string types
   constructed elsewhere since it only contains "UnicodeType" if it
   has been built in the running version of Python.  For example:
   "isinstance(s, types.StringTypes)".

   バージョン 2.2 で追加.
