Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Doc/glossary.rst

    r2 r388  
    2020   2to3
    2121      A tool that tries to convert Python 2.x code to Python 3.x code by
    22       handling most of the incompatibilites which can be detected by parsing the
     22      handling most of the incompatibilities which can be detected by parsing the
    2323      source and traversing the parse tree.
    2424
     
    2828
    2929   abstract base class
    30       Abstract Base Classes (abbreviated ABCs) complement :term:`duck-typing` by
     30      Abstract base classes complement :term:`duck-typing` by
    3131      providing a way to define interfaces when other techniques like
    32       :func:`hasattr` would be clumsy. Python comes with many built-in ABCs for
     32      :func:`hasattr` would be clumsy or subtly wrong (for example with
     33      :ref:`magic methods <new-style-special-lookup>`).  ABCs introduce virtual
     34      subclasses, which are classes that don't inherit from a class but are
     35      still recognized by :func:`isinstance` and :func:`issubclass`; see the
     36      :mod:`abc` module documentation.  Python comes with many built-in ABCs for
    3337      data structures (in the :mod:`collections` module), numbers (in the
    3438      :mod:`numbers` module), and streams (in the :mod:`io` module). You can
    35       create your own ABC with the :mod:`abc` module.
     39      create your own ABCs with the :mod:`abc` module.
    3640
    3741   argument
    38       A value passed to a function or method, assigned to a named local
    39       variable in the function body.  A function or method may have both
    40       positional arguments and keyword arguments in its definition.
    41       Positional and keyword arguments may be variable-length: ``*`` accepts
    42       or passes (if in the function definition or call) several positional
    43       arguments in a list, while ``**`` does the same for keyword arguments
    44       in a dictionary.
    45 
    46       Any expression may be used within the argument list, and the evaluated
    47       value is passed to the local variable.
     42      A value passed to a :term:`function` (or :term:`method`) when calling the
     43      function.  There are two types of arguments:
     44
     45      * :dfn:`keyword argument`: an argument preceded by an identifier (e.g.
     46        ``name=``) in a function call or passed as a value in a dictionary
     47        preceded by ``**``.  For example, ``3`` and ``5`` are both keyword
     48        arguments in the following calls to :func:`complex`::
     49
     50           complex(real=3, imag=5)
     51           complex(**{'real': 3, 'imag': 5})
     52
     53      * :dfn:`positional argument`: an argument that is not a keyword argument.
     54        Positional arguments can appear at the beginning of an argument list
     55        and/or be passed as elements of an :term:`iterable` preceded by ``*``.
     56        For example, ``3`` and ``5`` are both positional arguments in the
     57        following calls::
     58
     59           complex(3, 5)
     60           complex(*(3, 5))
     61
     62      Arguments are assigned to the named local variables in a function body.
     63      See the :ref:`calls` section for the rules governing this assignment.
     64      Syntactically, any expression can be used to represent an argument; the
     65      evaluated value is assigned to the local variable.
     66
     67      See also the :term:`parameter` glossary entry and the FAQ question on
     68      :ref:`the difference between arguments and parameters
     69      <faq-argument-vs-parameter>`.
    4870
    4971   attribute
     
    5678      <http://www.python.org/~guido/>`_, Python's creator.
    5779
     80   bytes-like object
     81      An object that supports the :ref:`buffer protocol <bufferobjects>`,
     82      like :class:`str`, :class:`bytearray` or :class:`memoryview`.
     83      Bytes-like objects can be used for various operations that expect
     84      binary data, such as compression, saving to a binary file or sending
     85      over a socket. Some operations need the binary data to be mutable,
     86      in which case not all bytes-like objects can apply.
     87
    5888   bytecode
    5989      Python source code is compiled into bytecode, the internal representation
    60       of a Python program in the interpreter.  The bytecode is also cached in
    61       ``.pyc`` and ``.pyo`` files so that executing the same file is faster the
    62       second time (recompilation from source to bytecode can be avoided).  This
    63       "intermediate language" is said to run on a :term:`virtual machine`
    64       that executes the machine code corresponding to each bytecode.
     90      of a Python program in the CPython interpreter.  The bytecode is also
     91      cached in ``.pyc`` and ``.pyo`` files so that executing the same file is
     92      faster the second time (recompilation from source to bytecode can be
     93      avoided).  This "intermediate language" is said to run on a
     94      :term:`virtual machine` that executes the machine code corresponding to
     95      each bytecode. Do note that bytecodes are not expected to work between
     96      different Python virtual machines, nor to be stable between Python
     97      releases.
     98
     99      A list of bytecode instructions can be found in the documentation for
     100      :ref:`the dis module <bytecodes>`.
    65101
    66102   class
     
    71107   classic class
    72108      Any class which does not inherit from :class:`object`.  See
    73       :term:`new-style class`.  Classic classes will be removed in Python 3.0.
     109      :term:`new-style class`.  Classic classes have been removed in Python 3.
    74110
    75111   coercion
     
    104140
    105141   CPython
    106       The canonical implementation of the Python programming language.  The
    107       term "CPython" is used in contexts when necessary to distinguish this
    108       implementation from others such as Jython or IronPython.
     142      The canonical implementation of the Python programming language, as
     143      distributed on `python.org <http://python.org>`_.  The term "CPython"
     144      is used when necessary to distinguish this implementation from others
     145      such as Jython or IronPython.
    109146
    110147   decorator
     
    124161             ...
    125162
    126       See :ref:`the documentation for function definition <function>` for more
    127       about decorators.
     163      The same concept exists for classes, but is less commonly used there.  See
     164      the documentation for :ref:`function definitions <function>` and
     165      :ref:`class definitions <class>` for more about decorators.
    128166
    129167   descriptor
     
    141179
    142180   dictionary
    143       An associative array, where arbitrary keys are mapped to values.  The use
    144       of :class:`dict` closely resembles that for :class:`list`, but the keys can
    145       be any object with a :meth:`__hash__` function, not just integers.
     181      An associative array, where arbitrary keys are mapped to values.  The
     182      keys can be any object with :meth:`__hash__`  and :meth:`__eq__` methods.
    146183      Called a hash in Perl.
    147184
     
    155192
    156193   duck-typing
    157       A pythonic programming style which determines an object's type by inspection
    158       of its method or attribute signature rather than by explicit relationship
    159       to some type object ("If it looks like a duck and quacks like a duck, it
     194      A programming style which does not look at an object's type to determine
     195      if it has the right interface; instead, the method or attribute is simply
     196      called or used ("If it looks like a duck and quacks like a duck, it
    160197      must be a duck.")  By emphasizing interfaces rather than specific types,
    161198      well-designed code improves its flexibility by allowing polymorphic
    162199      substitution.  Duck-typing avoids tests using :func:`type` or
    163       :func:`isinstance`. (Note, however, that duck-typing can be complemented
    164       with abstract base classes.) Instead, it typically employs :func:`hasattr`
    165       tests or :term:`EAFP` programming.
     200      :func:`isinstance`.  (Note, however, that duck-typing can be complemented
     201      with :term:`abstract base classes <abstract base class>`.)  Instead, it
     202      typically employs :func:`hasattr` tests or :term:`EAFP` programming.
    166203
    167204   EAFP
     
    175212   expression
    176213      A piece of syntax which can be evaluated to some value.  In other words,
    177       an expression is an accumulation of expression elements like literals, names,
    178       attribute access, operators or function calls which all return a value.
    179       In contrast to many other languages, not all language constructs are expressions.
    180       There are also :term:`statement`\s which cannot be used as expressions,
    181       such as :keyword:`print` or :keyword:`if`.  Assignments are also statements,
    182       not expressions.
     214      an expression is an accumulation of expression elements like literals,
     215      names, attribute access, operators or function calls which all return a
     216      value.  In contrast to many other languages, not all language constructs
     217      are expressions.  There are also :term:`statement`\s which cannot be used
     218      as expressions, such as :keyword:`print` or :keyword:`if`.  Assignments
     219      are also statements, not expressions.
    183220
    184221   extension module
    185       A module written in C or C++, using Python's C API to interact with the core and
    186       with user code.
     222      A module written in C or C++, using Python's C API to interact with the
     223      core and with user code.
     224
     225   file object
     226      An object exposing a file-oriented API (with methods such as
     227      :meth:`read()` or :meth:`write()`) to an underlying resource.  Depending
     228      on the way it was created, a file object can mediate access to a real
     229      on-disk file or to another type of storage or communication device
     230      (for example standard input/output, in-memory buffers, sockets, pipes,
     231      etc.).  File objects are also called :dfn:`file-like objects` or
     232      :dfn:`streams`.
     233
     234      There are actually three categories of file objects: raw binary files,
     235      buffered binary files and text files.  Their interfaces are defined in the
     236      :mod:`io` module.  The canonical way to create a file object is by using
     237      the :func:`open` function.
     238
     239   file-like object
     240      A synonym for :term:`file object`.
    187241
    188242   finder
     
    191245      details.
    192246
     247   floor division
     248      Mathematical division that rounds down to nearest integer.  The floor
     249      division operator is ``//``.  For example, the expression ``11 // 4``
     250      evaluates to ``2`` in contrast to the ``2.75`` returned by float true
     251      division.  Note that ``(-11) // 4`` is ``-3`` because that is ``-2.75``
     252      rounded *downward*. See :pep:`238`.
     253
    193254   function
    194255      A series of statements which returns some value to a caller. It can also
    195       be passed zero or more arguments which may be used in the execution of
    196       the body. See also :term:`argument` and :term:`method`.
     256      be passed zero or more :term:`arguments <argument>` which may be used in
     257      the execution of the body. See also :term:`parameter`, :term:`method`,
     258      and the :ref:`function` section.
    197259
    198260   __future__
    199       A pseudo module which programmers can use to enable new language features
     261      A pseudo-module which programmers can use to enable new language features
    200262      which are not compatible with the current interpreter.  For example, the
    201263      expression ``11/4`` currently evaluates to ``2``. If the module in which
     
    218280      collector that is able to detect and break reference cycles.
    219281
     282      .. index:: single: generator
     283
    220284   generator
    221285      A function which returns an iterator.  It looks like a normal function
    222       except that values are returned to the caller using a :keyword:`yield`
    223       statement instead of a :keyword:`return` statement.  Generator functions
    224       often contain one or more :keyword:`for` or :keyword:`while` loops which
    225       :keyword:`yield` elements back to the caller.  The function execution is
    226       stopped at the :keyword:`yield` keyword (returning the result) and is
    227       resumed there when the next element is requested by calling the
    228       :meth:`next` method of the returned iterator.
     286      except that it contains :keyword:`yield` statements for producing a series
     287      a values usable in a for-loop or that can be retrieved one at a time with
     288      the :func:`next` function. Each :keyword:`yield` temporarily suspends
     289      processing, remembering the location execution state (including local
     290      variables and pending try-statements).  When the generator resumes, it
     291      picks-up where it left-off (in contrast to functions which start fresh on
     292      every invocation).
    229293
    230294      .. index:: single: generator expression
    231295
    232296   generator expression
    233       An expression that returns a generator.  It looks like a normal expression
     297      An expression that returns an iterator.  It looks like a normal expression
    234298      followed by a :keyword:`for` expression defining a loop variable, range,
    235299      and an optional :keyword:`if` expression.  The combined expression
     
    243307
    244308   global interpreter lock
    245       The lock used by Python threads to assure that only one thread
    246       executes in the :term:`CPython` :term:`virtual machine` at a time.
    247       This simplifies the CPython implementation by assuring that no two
    248       processes can access the same memory at the same time.  Locking the
    249       entire interpreter makes it easier for the interpreter to be
    250       multi-threaded, at the expense of much of the parallelism afforded by
    251       multi-processor machines.  Efforts have been made in the past to
    252       create a "free-threaded" interpreter (one which locks shared data at a
    253       much finer granularity), but so far none have been successful because
    254       performance suffered in the common single-processor case.
     309      The mechanism used by the :term:`CPython` interpreter to assure that
     310      only one thread executes Python :term:`bytecode` at a time.
     311      This simplifies the CPython implementation by making the object model
     312      (including critical built-in types such as :class:`dict`) implicitly
     313      safe against concurrent access.  Locking the entire interpreter
     314      makes it easier for the interpreter to be multi-threaded, at the
     315      expense of much of the parallelism afforded by multi-processor
     316      machines.
     317
     318      However, some extension modules, either standard or third-party,
     319      are designed so as to release the GIL when doing computationally-intensive
     320      tasks such as compression or hashing.  Also, the GIL is always released
     321      when doing I/O.
     322
     323      Past efforts to create a "free-threaded" interpreter (one which locks
     324      shared data at a much finer granularity) have not been successful
     325      because performance suffered in the common single-processor case. It
     326      is believed that overcoming this performance issue would make the
     327      implementation much more complicated and therefore costlier to maintain.
    255328
    256329   hashable
     
    266339      containers (such as lists or dictionaries) are.  Objects which are
    267340      instances of user-defined classes are hashable by default; they all
    268       compare unequal, and their hash value is their :func:`id`.
     341      compare unequal (except with themselves), and their hash value is their
     342      :func:`id`.
    269343
    270344   IDLE
    271345      An Integrated Development Environment for Python.  IDLE is a basic editor
    272346      and interpreter environment which ships with the standard distribution of
    273       Python.  Good for beginners, it also serves as clear example code for
    274       those wanting to implement a moderately sophisticated, multi-platform GUI
    275       application.
     347      Python.
    276348
    277349   immutable
     
    294366      instead of the ``/`` operator.  See also :term:`__future__`.
    295367
     368   importing
     369      The process by which Python code in one module is made available to
     370      Python code in another module.
     371
    296372   importer
    297373      An object that both finds and loads a module; both a
     
    316392
    317393   iterable
    318       A container object capable of returning its members one at a
    319       time. Examples of iterables include all sequence types (such as
    320       :class:`list`, :class:`str`, and :class:`tuple`) and some non-sequence
    321       types like :class:`dict` and :class:`file` and objects of any classes you
    322       define with an :meth:`__iter__` or :meth:`__getitem__` method.  Iterables
    323       can be used in a :keyword:`for` loop and in many other places where a
    324       sequence is needed (:func:`zip`, :func:`map`, ...).  When an iterable
    325       object is passed as an argument to the built-in function :func:`iter`, it
    326       returns an iterator for the object.  This iterator is good for one pass
    327       over the set of values.  When using iterables, it is usually not necessary
    328       to call :func:`iter` or deal with iterator objects yourself.  The ``for``
     394      An object capable of returning its members one at a time. Examples of
     395      iterables include all sequence types (such as :class:`list`, :class:`str`,
     396      and :class:`tuple`) and some non-sequence types like :class:`dict`
     397      and :class:`file` and objects of any classes you define
     398      with an :meth:`__iter__` or :meth:`__getitem__` method.  Iterables can be
     399      used in a :keyword:`for` loop and in many other places where a sequence is
     400      needed (:func:`zip`, :func:`map`, ...).  When an iterable object is passed
     401      as an argument to the built-in function :func:`iter`, it returns an
     402      iterator for the object.  This iterator is good for one pass over the set
     403      of values.  When using iterables, it is usually not necessary to call
     404      :func:`iter` or deal with iterator objects yourself.  The ``for``
    329405      statement does that automatically for you, creating a temporary unnamed
    330406      variable to hold the iterator for the duration of the loop.  See also
     
    348424      More information can be found in :ref:`typeiter`.
    349425
     426   key function
     427      A key function or collation function is a callable that returns a value
     428      used for sorting or ordering.  For example, :func:`locale.strxfrm` is
     429      used to produce a sort key that is aware of locale specific sort
     430      conventions.
     431
     432      A number of tools in Python accept key functions to control how elements
     433      are ordered or grouped.  They include :func:`min`, :func:`max`,
     434      :func:`sorted`, :meth:`list.sort`, :func:`heapq.nsmallest`,
     435      :func:`heapq.nlargest`, and :func:`itertools.groupby`.
     436
     437      There are several ways to create a key function.  For example. the
     438      :meth:`str.lower` method can serve as a key function for case insensitive
     439      sorts.  Alternatively, an ad-hoc key function can be built from a
     440      :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``.  Also,
     441      the :mod:`operator` module provides three key function constructors:
     442      :func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and
     443      :func:`~operator.methodcaller`.  See the :ref:`Sorting HOW TO
     444      <sortinghowto>` for examples of how to create and use key functions.
     445
    350446   keyword argument
    351       Arguments which are preceded with a ``variable_name=`` in the call.
    352       The variable name designates the local name in the function to which the
    353       value is assigned.  ``**`` is used to accept or pass a dictionary of
    354       keyword arguments.  See :term:`argument`.
     447      See :term:`argument`.
    355448
    356449   lambda
     
    364457      the :term:`EAFP` approach and is characterized by the presence of many
    365458      :keyword:`if` statements.
     459
     460      In a multi-threaded environment, the LBYL approach can risk introducing a
     461      race condition between "the looking" and "the leaping".  For example, the
     462      code, ``if key in mapping: return mapping[key]`` can fail if another
     463      thread removes *key* from *mapping* after the test, but before the lookup.
     464      This issue can be solved with locks or by using the EAFP approach.
    366465
    367466   list
     
    384483
    385484   mapping
    386       A container object (such as :class:`dict`) which supports arbitrary key
    387       lookups using the special method :meth:`__getitem__`.
     485      A container object that supports arbitrary key lookups and implements the
     486      methods specified in the :class:`~collections.Mapping` or
     487      :class:`~collections.MutableMapping`
     488      :ref:`abstract base classes <collections-abstract-base-classes>`.  Examples
     489      include :class:`dict`, :class:`collections.defaultdict`,
     490      :class:`collections.OrderedDict` and :class:`collections.Counter`.
    388491
    389492   metaclass
     
    405508      its first :term:`argument` (which is usually called ``self``).
    406509      See :term:`function` and :term:`nested scope`.
     510
     511   method resolution order
     512      Method Resolution Order is the order in which base classes are searched
     513      for a member during lookup. See `The Python 2.3 Method Resolution Order
     514      <http://www.python.org/download/releases/2.3/mro/>`_.
     515
     516   module
     517      An object that serves as an organizational unit of Python code.  Modules
     518      have a namespace containing arbitrary Python objects.  Modules are loaded
     519      into Python by the process of :term:`importing`.
     520
     521      See also :term:`package`.
     522
     523   MRO
     524      See :term:`method resolution order`.
    407525
    408526   mutable
     
    446564      Any class which inherits from :class:`object`.  This includes all built-in
    447565      types like :class:`list` and :class:`dict`.  Only new-style classes can
    448       use Python's newer, versatile features like :attr:`__slots__`,
     566      use Python's newer, versatile features like :attr:`~object.__slots__`,
    449567      descriptors, properties, and :meth:`__getattribute__`.
    450568
     
    456574      class`.
    457575
     576   package
     577      A Python :term:`module` which can contain submodules or recursively,
     578      subpackages.  Technically, a package is a Python module with an
     579      ``__path__`` attribute.
     580
     581   parameter
     582      A named entity in a :term:`function` (or method) definition that
     583      specifies an :term:`argument` (or in some cases, arguments) that the
     584      function can accept.  There are four types of parameters:
     585
     586      * :dfn:`positional-or-keyword`: specifies an argument that can be passed
     587        either :term:`positionally <argument>` or as a :term:`keyword argument
     588        <argument>`.  This is the default kind of parameter, for example *foo*
     589        and *bar* in the following::
     590
     591           def func(foo, bar=None): ...
     592
     593      * :dfn:`positional-only`: specifies an argument that can be supplied only
     594        by position.  Python has no syntax for defining positional-only
     595        parameters.  However, some built-in functions have positional-only
     596        parameters (e.g. :func:`abs`).
     597
     598      * :dfn:`var-positional`: specifies that an arbitrary sequence of
     599        positional arguments can be provided (in addition to any positional
     600        arguments already accepted by other parameters).  Such a parameter can
     601        be defined by prepending the parameter name with ``*``, for example
     602        *args* in the following::
     603
     604           def func(*args, **kwargs): ...
     605
     606      * :dfn:`var-keyword`: specifies that arbitrarily many keyword arguments
     607        can be provided (in addition to any keyword arguments already accepted
     608        by other parameters).  Such a parameter can be defined by prepending
     609        the parameter name with ``**``, for example *kwargs* in the example
     610        above.
     611
     612      Parameters can specify both optional and required arguments, as well as
     613      default values for some optional arguments.
     614
     615      See also the :term:`argument` glossary entry, the FAQ question on
     616      :ref:`the difference between arguments and parameters
     617      <faq-argument-vs-parameter>`, and the :ref:`function` section.
     618
    458619   positional argument
    459       The arguments assigned to local names inside a function or method,
    460       determined by the order in which they were given in the call.  ``*`` is
    461       used to either accept multiple positional arguments (when in the
    462       definition), or pass several arguments as a list to a function.  See
    463       :term:`argument`.
     620      See :term:`argument`.
    464621
    465622   Python 3000
    466       Nickname for the next major Python version, 3.0 (coined long ago
    467       when the release of version 3 was something in the distant future.)  This
    468       is also abbreviated "Py3k".
     623      Nickname for the Python 3.x release line (coined long ago when the release
     624      of version 3 was something in the distant future.)  This is also
     625      abbreviated "Py3k".
    469626
    470627   Pythonic
     
    489646      generally not visible to Python code, but it is a key element of the
    490647      :term:`CPython` implementation.  The :mod:`sys` module defines a
    491       :func:`getrefcount` function that programmers can call to return the
     648      :func:`~sys.getrefcount` function that programmers can call to return the
    492649      reference count for a particular object.
    493650
     
    524681   statement
    525682      A statement is part of a suite (a "block" of code).  A statement is either
    526       an :term:`expression` or a one of several constructs with a keyword, such
    527       as :keyword:`if`, :keyword:`while` or :keyword:`print`.
     683      an :term:`expression` or one of several constructs with a keyword, such
     684      as :keyword:`if`, :keyword:`while` or :keyword:`for`.
     685
     686   struct sequence
     687      A tuple with named elements. Struct sequences expose an interface similiar
     688      to :term:`named tuple` in that elements can either be accessed either by
     689      index or as an attribute. However, they do not have any of the named tuple
     690      methods like :meth:`~collections.somenamedtuple._make` or
     691      :meth:`~collections.somenamedtuple._asdict`. Examples of struct sequences
     692      include :data:`sys.float_info` and the return value of :func:`os.stat`.
    528693
    529694   triple-quoted string
     
    539704      The type of a Python object determines what kind of object it is; every
    540705      object has a type.  An object's type is accessible as its
    541       :attr:`__class__` attribute or can be retrieved with ``type(obj)``.
     706      :attr:`~instance.__class__` attribute or can be retrieved with
     707      ``type(obj)``.
     708
     709   universal newlines
     710      A manner of interpreting text streams in which all of the following are
     711      recognized as ending a line: the Unix end-of-line convention ``'\n'``,
     712      the Windows convention ``'\r\n'``, and the old Macintosh convention
     713      ``'\r'``.  See :pep:`278` and :pep:`3116`, as well as
     714      :func:`str.splitlines` for an additional use.
     715
     716   view
     717      The objects returned from :meth:`dict.viewkeys`, :meth:`dict.viewvalues`,
     718      and :meth:`dict.viewitems` are called dictionary views.  They are lazy
     719      sequences that will see changes in the underlying dictionary.  To force
     720      the dictionary view to become a full list use ``list(dictview)``.  See
     721      :ref:`dict-views`.
    542722
    543723   virtual machine
Note: See TracChangeset for help on using the changeset viewer.