Lines Matching +full:shared +full:- +full:library +full:- +full:atoms
16 .. productionlist:: python-grammar
32 implementation for built-in types works as follows:
48 Atoms chapter
53 Atoms are the most basic elements of expressions. The simplest atoms are
55 also categorized syntactically as atoms. The syntax for atoms is:
57 .. productionlist:: python-grammar
63 .. _atom-identifiers:
66 -------------------
97 .. _atom-literals:
100 --------
106 .. productionlist:: python-grammar
129 -------------------
137 .. productionlist:: python-grammar
156 required --- allowing unparenthesized "nothing" in expressions would cause
163 -----------------------------------------
182 .. productionlist:: python-grammar
235 -------------
248 .. productionlist:: python-grammar
252 a list of expressions or a comprehension. When a comma-separated list of
261 ------------
273 .. productionlist:: python-grammar
277 either a sequence of expressions or a comprehension. When a comma-separated
289 -------------------
303 .. productionlist:: python-grammar
311 If a comma-separated sequence of key/datum pairs is given, they are evaluated
345 and value was not well-defined. In CPython, the value was evaluated before
353 ---------------------
362 .. productionlist:: python-grammar
391 which is an asynchronous iterator (see :ref:`async-iterators`).
408 -----------------
416 .. productionlist:: python-grammar
443 :ref:`asynchronous-generator-functions`.
473 the generator-iterator's :meth:`~generator.close` method will be called,
502 :pep:`255` - Simple Generators
505 :pep:`342` - Coroutines via Enhanced Generators
509 :pep:`380` - Syntax for Delegating to a Subgenerator
513 :pep:`525` - Asynchronous Generators
518 .. _generator-methods:
520 Generator-iterator methods
544 by the built-in :func:`next` function.
563 raised. If the generator function does not catch the passed-in exception, or
611 For examples using ``yield from``, see :ref:`pep-380` in "What's New in
614 .. _asynchronous-generator-functions:
653 generator-iterator's :meth:`~agen.aclose` method and run the resulting
658 a *finalizer* function which takes an asynchronous generator-iterator
661 When first iterated over, an asynchronous generator-iterator will store the
669 .. index:: object: asynchronous-generator
670 .. _asynchronous-generator-methods:
672 Asynchronous generator-iterator methods
721 If the generator function does not catch the passed-in exception, or
753 .. productionlist:: python-grammar
757 .. _attribute-references:
760 --------------------
768 .. productionlist:: python-grammar
788 -------------
806 .. productionlist:: python-grammar
810 dictionaries for example). User-defined objects can support subscription by
813 For built-in objects, there are two types of objects that support subscription:
824 sequences; however, built-in sequences all provide a :meth:`__getitem__`
826 to the index (so that ``x[-1]`` selects the last item of ``x``). The
841 creates a :ref:`generic alias <types-genericalias>`.
842 In this case, user-defined classes can support subscription by providing a
849 --------
867 .. productionlist:: python-grammar
912 -----
917 .. productionlist:: python-grammar
937 The primary must evaluate to a callable object (user-defined functions, built-in
938 functions, methods of built-in objects, class objects, methods of class
957 value will be shared by all calls that don't specify an argument value for the
963 .. impl-detail::
965 An implementation may provide built-in functions whose positional parameters
997 keyword arguments (and any ``**expression`` arguments -- see below). So::
1036 If it is---
1038 a user-defined function:
1041 triple: user-defined; function; call
1042 object: user-defined function
1051 a built-in function or method:
1054 pair: built-in function; call
1056 pair: built-in method; call
1057 object: built-in method
1058 object: built-in function
1062 The result is up to the interpreter; see :ref:`built-in-funcs` for the
1063 descriptions of built-in functions and methods.
1078 The corresponding user-defined function is called, with an argument list that is
1100 .. productionlist:: python-grammar
1118 .. productionlist:: python-grammar
1123 for the operands): ``-1**2`` results in ``-1``.
1125 The power operator has the same semantics as the built-in :func:`pow` function,
1133 ``10**-2`` returns ``0.01``.
1151 .. productionlist:: python-grammar
1152 u_expr: `power` | "-" `u_expr` | "+" `u_expr` | "~" `u_expr`
1157 single: operator; - (minus)
1158 single: - (minus); unary operator
1160 The unary ``-`` (minus) operator yields the negation of its numeric argument.
1174 argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only
1191 that some of these operations also apply to certain non-numeric types. Apart
1195 .. productionlist:: python-grammar
1199 a_expr: `m_expr` | `a_expr` "+" `m_expr` | `a_expr` "-" `m_expr`
1248 connected with the built-in function :func:`divmod`: ``divmod(x, y) == (x//y,
1252 also overloaded by string objects to perform old-style string formatting (also
1254 Python Library Reference, section :ref:`old-string-formatting`.
1272 single: operator; - (minus)
1273 single: - (minus); binary operator
1275 The ``-`` (subtraction) operator yields the difference of its arguments. The
1291 .. productionlist:: python-grammar
1312 .. productionlist:: python-grammar
1361 .. productionlist:: python-grammar
1384 -----------------
1417 have a sensible definition of object value and value-based equality. Such
1419 of built-in types have done that.
1422 built-in types.
1424 * Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard
1425 library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can be
1431 The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are
1432 special. Any ordered comparison of a number to a not-a-number value is false.
1433 A counter-intuitive implication is that not-a-number values are not equal to
1447 numerical Unicode code points (the result of the built-in function
1459 elements. The built-in containers typically assume identical objects are
1463 Lexicographical comparison between built-in collections works as follows:
1465 - For two collections to compare equal, they must be of the same type, have
1470 - Collections that support order comparison are ordered the same as their
1495 * Most other built-in types have no comparison methods implemented, so they
1498 User-defined classes that customize their comparison behavior should follow
1518 The following (non-exhaustive) examples illustrate that:
1541 Python does not enforce these consistency rules. In fact, the not-a-number
1547 .. _membership-test-details:
1550 --------------------------
1554 ``x not in s`` returns the negation of ``x in s``. All built-in sequences and
1561 substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty strings are
1565 For user-defined classes which define the :meth:`__contains__` method, ``x in
1569 For user-defined classes which do not define :meth:`__contains__` but do define
1575 Lastly, the old-style iteration protocol is tried: if a class defines
1576 :meth:`__getitem__`, ``x in y`` is ``True`` if and only if there is a non-negative
1600 --------------------
1620 .. productionlist:: python-grammar
1629 other values are interpreted as true. User-defined objects can customize their
1659 .. productionlist:: python-grammar
1668 .. code-block:: python
1675 .. code-block:: python
1695 .. productionlist:: python-grammar
1722 .. productionlist:: python-grammar
1730 .. code-block:: none
1749 .. productionlist:: python-grammar
1791 an assignment, the right-hand side is evaluated before the left-hand side.
1799 expr1 + expr2 * (expr3 - expr4)
1804 .. _operator-summary:
1819 precedence and have a left-to-right chaining feature as described in the
1823 +-----------------------------------------------+-------------------------------------+
1827 +-----------------------------------------------+-------------------------------------+
1829 +-----------------------------------------------+-------------------------------------+
1830 | :keyword:`if <if_expr>` -- :keyword:`!else` | Conditional expression |
1831 +-----------------------------------------------+-------------------------------------+
1833 +-----------------------------------------------+-------------------------------------+
1835 +-----------------------------------------------+-------------------------------------+
1837 +-----------------------------------------------+-------------------------------------+
1841 +-----------------------------------------------+-------------------------------------+
1843 +-----------------------------------------------+-------------------------------------+
1845 +-----------------------------------------------+-------------------------------------+
1847 +-----------------------------------------------+-------------------------------------+
1849 +-----------------------------------------------+-------------------------------------+
1850 | ``+``, ``-`` | Addition and subtraction |
1851 +-----------------------------------------------+-------------------------------------+
1855 +-----------------------------------------------+-------------------------------------+
1856 | ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |
1857 +-----------------------------------------------+-------------------------------------+
1859 +-----------------------------------------------+-------------------------------------+
1861 +-----------------------------------------------+-------------------------------------+
1864 +-----------------------------------------------+-------------------------------------+
1870 +-----------------------------------------------+-------------------------------------+
1877 a Python float is an IEEE 754 double-precision number, in order that ``-1e-100 %
1878 1e100`` have the same sign as ``1e100``, the computed result is ``-1e-100 +
1881 first argument instead, and so returns ``-1e-100`` in this case. Which approach
1885 ``x//y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such
1901 points. This may be counter-intuitive to humans. For example,
1908 .. [#] Due to automatic garbage-collection, free lists, and the dynamic nature of
1917 bitwise unary operator on its right, that is, ``2**-1`` is ``0.5``.