Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/reference/simple_stmts.rst

    r2 r391  
    122122  iterable with the same number of items as there are targets in the target list,
    123123  and the items are assigned, from left to right, to the corresponding targets.
    124   (This rule is relaxed as of Python 1.5; in earlier versions, the object had to
    125   be a tuple.  Since strings are sequences, an assignment like ``a, b = "xy"`` is
    126   now legal as long as the string has the right length.)
    127124
    128125Assignment of an object to a single target is recursively defined as follows.
     
    356353
    357354Deletion is recursively defined very similar to the way assignment is defined.
    358 Rather that spelling it out in full details, here are some hints.
     355Rather than spelling it out in full details, here are some hints.
    359356
    360357Deletion of a target list recursively deletes each target, from left to right.
     
    515512clauses to execute.
    516513
     514For full details of :keyword:`yield` semantics, refer to the :ref:`yieldexpr`
     515section.
     516
    517517.. note::
    518518
     
    710710:attr:`__path__` attribute from the parent package (everything up to the last
    711711dot in the name of the module being imported). If a finder can find the module
    712 it returns a :term:`loader` (discussed later) or returns :keyword:`None`.
     712it returns a :term:`loader` (discussed later) or returns ``None``.
    713713
    714714.. index::
     
    737737:exc:`ImportError`. If a finder is returned then it is cached in
    738738:data:`sys.path_importer_cache` and then used for that path entry. If no finder
    739 can be found but the path exists then a value of :keyword:`None` is
     739can be found but the path exists then a value of ``None`` is
    740740stored in :data:`sys.path_importer_cache` to signify that an implicit,
    741741file-based finder that handles modules stored as individual files should be
    742742used for that path. If the path does not exist then a finder which always
    743 returns :keyword:`None` is placed in the cache for the path.
     743returns ``None`` is placed in the cache for the path.
    744744
    745745.. index::
     
    837837So if you execute ``from . import mod`` from a module in the ``pkg`` package
    838838then you will end up importing ``pkg.mod``. If you execute ``from ..subpkg2
    839 imprt mod`` from within ``pkg.subpkg1`` you will import ``pkg.subpkg2.mod``.
     839import mod`` from within ``pkg.subpkg1`` you will import ``pkg.subpkg2.mod``.
    840840The specification for relative imports is contained within :pep:`328`.
    841841
    842 
    843 .. index:: builtin: __import__
    844 
    845 The built-in function :func:`__import__` is provided to support applications
    846 that determine which modules need to be loaded dynamically; refer to
    847 :ref:`built-in-funcs` for additional information.
     842:func:`importlib.import_module` is provided to support applications that
     843determine which modules need to be loaded dynamically.
    848844
    849845
     
    986982
    987983This statement supports dynamic execution of Python code.  The first expression
    988 should evaluate to either a string, an open file object, or a code object.  If
    989 it is a string, the string is parsed as a suite of Python statements which is
    990 then executed (unless a syntax error occurs). [#]_  If it is an open file, the file
    991 is parsed until EOF and executed.  If it is a code object, it is simply
    992 executed.  In all cases, the code that's executed is expected to be valid as
    993 file input (see section :ref:`file-input`).  Be aware that the
     984should evaluate to either a Unicode string, a *Latin-1* encoded string, an open
     985file object, a code object, or a tuple.  If it is a string, the string is parsed
     986as a suite of Python statements which is then executed (unless a syntax error
     987occurs). [#]_ If it is an open file, the file is parsed until EOF and executed.
     988If it is a code object, it is simply executed.  For the interpretation of a
     989tuple, see below.  In all cases, the code that's executed is expected to be
     990valid as file input (see section :ref:`file-input`).  Be aware that the
    994991:keyword:`return` and :keyword:`yield` statements may not be used outside of
    995992function definitions even within the context of code passed to the
     
    997994
    998995In all cases, if the optional parts are omitted, the code is executed in the
    999 current scope.  If only the first expression after :keyword:`in` is specified,
     996current scope.  If only the first expression after ``in`` is specified,
    1000997it should be a dictionary, which will be used for both the global and the local
    1001998variables.  If two expressions are given, they are used for the global and local
    1002999variables, respectively. If provided, *locals* can be any mapping object.
     1000Remember that at module level, globals and locals are the same dictionary. If
     1001two separate objects are given as *globals* and *locals*, the code will be
     1002executed as if it were embedded in a class definition.
     1003
     1004The first expression may also be a tuple of length 2 or 3.  In this case, the
     1005optional parts must be omitted.  The form ``exec(expr, globals)`` is equivalent
     1006to ``exec expr in globals``, while the form ``exec(expr, globals, locals)`` is
     1007equivalent to ``exec expr in globals, locals``.  The tuple form of ``exec``
     1008provides compatibility with Python 3, where ``exec`` is a function rather than
     1009a statement.
    10031010
    10041011.. versionchanged:: 2.4
     
    10291036
    10301037.. [#] Note that the parser only accepts the Unix-style end of line convention.
    1031        If you are reading the code from a file, make sure to use universal
    1032        newline mode to convert Windows or Mac-style newlines.
     1038       If you are reading the code from a file, make sure to use
     1039       :term:`universal newlines` mode to convert Windows or Mac-style newlines.
Note: See TracChangeset for help on using the changeset viewer.