|
Original |
Translation |
|
25
|
A pythonic programming style which determines an object's type by inspection of its method or attribute signature rather than by explicit relationship to some type object ("If it looks like a duck and quacks like a duck, it must be a duck.") By emphasizing interfaces rather than specific types, well-designed code improves its flexibility by allowing polymorphic substitution. Duck-typing avoids tests using :func:`type` or :func:`isinstance`. (Note, however, that duck-typing can be complemented with abstract base classes.) Instead, it typically employs :func:`hasattr` tests or :term:`EAFP` programming.
|
|
|
26
|
Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many :keyword:`try` and :keyword:`except` statements. The technique contrasts with the :term:`LBYL` style common to many other languages such as C.
|
|
|
27
|
A piece of syntax which can be evaluated to some value. In other words, an expression is an accumulation of expression elements like literals, names, attribute access, operators or function calls which all return a value. In contrast to many other languages, not all language constructs are expressions. There are also :term:`statement`\s which cannot be used as expressions, such as :keyword:`if`. Assignments are also statements, not expressions.
|
Une suite logique de termes et chiffres conformes à la syntaxe Python dont l'évaluation fournit une valeur. En d'autres termes, une expression est une suite d'éléments tels que des noms, opérateurs, littéraux, accès d'attributs, méthodes ou fonctions qui aboutissent à une valeur. Contrairement à beaucoup d'autres langages, les différentes constructions du langage ne sont pas toutes des expressions. Il y a également des :term:`statement`s qui ne peuvent pas être utilisés comme expressions, tel que :keyword:`if`. Les affectations sont également des :term:`statements` et non des expressions.
|
|
28
|
A module written in C or C++, using Python's C API to interact with the core and with user code.
|
Un module écrit en C ou C++, utilisant l'API C de Python afin d'intéragir avec le noyau et le code utilisateur.
|
|
29
|
An object that tries to find the :term:`loader` for a module. It must implement a method named :meth:`find_module`. See :pep:`302` for details and :class:`importlib.abc.Finder` for an :term:`abstract base class`.
|
|
|
30
|
|
31
|
A series of statements which returns some value to a caller. It can also be passed zero or more arguments which may be used in the execution of the body. See also :term:`argument` and :term:`method`.
|
|
|
32
|
A pseudo module which programmers can use to enable new language features which are not compatible with the current interpreter.
|
|
|
33
|
By importing the :mod:`__future__` module and evaluating its variables, you can see when a new feature was first added to the language and when it becomes the default::
|
|
|
34
|
>>> import __future__ >>> __future__.division _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
|
|