Merge from upstream/3.7 (#606)
This commit is contained in:
parent 7ad224d946
commit 703a04d9d2
40 changed files with 3070 additions and 2834 deletions
| | @ -5,7 +5,7 @@ msgid "" | |||
msgstr "" | ||||
"Project-Id-Version: Python 3.6\n" | ||||
"Report-Msgid-Bugs-To: \n" | ||||
"POT-Creation-Date: 2018-12-21 09:48+0100\n" | ||||
"POT-Creation-Date: 2019-03-11 12:59+0100\n" | ||||
"PO-Revision-Date: 2018-11-13 09:44+0100\n" | ||||
"Last-Translator: \n" | ||||
"Language-Team: FRENCH <traductions@lists.afpy.org>\n" | ||||
| | @ -1663,10 +1663,6 @@ msgid "" | |||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1321 | ||||
msgid "Dictionaries" | ||||
msgstr "Dictionnaires" | ||||
| ||||
#: ../Doc/faq/programming.rst:1324 | ||||
msgid "" | ||||
"I want to do a complicated sort: can you do a Schwartzian Transform in " | ||||
"Python?" | ||||
| | @ -1674,7 +1670,7 @@ msgstr "" | |||
"Je souhaite faire un tri compliqué: peut on faire une transformation de " | ||||
"Schwartz en Python?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1326 | ||||
#: ../Doc/faq/programming.rst:1323 | ||||
msgid "" | ||||
"The technique, attributed to Randal Schwartz of the Perl community, sorts " | ||||
"the elements of a list by a metric which maps each element to its \"sort " | ||||
| | @ -1682,12 +1678,12 @@ msgid "" | |||
"method::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1335 | ||||
#: ../Doc/faq/programming.rst:1332 | ||||
msgid "How can I sort one list by values from another list?" | ||||
msgstr "" | ||||
"Comment puis-je trier une liste en fonction des valeurs d'une autre liste?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1337 | ||||
#: ../Doc/faq/programming.rst:1334 | ||||
msgid "" | ||||
"Merge them into an iterator of tuples, sort the resulting list, and then " | ||||
"pick out the element you want. ::" | ||||
| | @ -1695,11 +1691,11 @@ msgstr "" | |||
"Fusionnez les dans un itérateur de tuples, triez la liste obtenue, puis " | ||||
"choisissez l'élément que vous voulez. ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1351 | ||||
#: ../Doc/faq/programming.rst:1348 | ||||
msgid "An alternative for the last step is::" | ||||
msgstr "Une alternative pour la dernière étape est : ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1356 | ||||
#: ../Doc/faq/programming.rst:1353 | ||||
msgid "" | ||||
"If you find this more legible, you might prefer to use this instead of the " | ||||
"final list comprehension. However, it is almost twice as slow for long " | ||||
| | @ -1718,15 +1714,15 @@ msgstr "" | |||
"exige une recherche d'attribut supplémentaire, et enfin, tous ces appels de " | ||||
"fonction impactent la vitesse d'exécution." | ||||
| ||||
#: ../Doc/faq/programming.rst:1366 | ||||
#: ../Doc/faq/programming.rst:1363 | ||||
msgid "Objects" | ||||
msgstr "Objets" | ||||
| ||||
#: ../Doc/faq/programming.rst:1369 | ||||
#: ../Doc/faq/programming.rst:1366 | ||||
msgid "What is a class?" | ||||
msgstr "Qu'est-ce qu'une classe?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1371 | ||||
#: ../Doc/faq/programming.rst:1368 | ||||
msgid "" | ||||
"A class is the particular object type created by executing a class " | ||||
"statement. Class objects are used as templates to create instance objects, " | ||||
| | @ -1738,7 +1734,7 @@ msgstr "" | |||
"créer des objets, qui incarnent à la fois les données (attributs) et le code " | ||||
"(méthodes) spécifiques à un type de données." | ||||
| ||||
#: ../Doc/faq/programming.rst:1375 | ||||
#: ../Doc/faq/programming.rst:1372 | ||||
msgid "" | ||||
"A class can be based on one or more other classes, called its base " | ||||
"class(es). It then inherits the attributes and methods of its base classes. " | ||||
| | @ -1755,11 +1751,11 @@ msgstr "" | |||
"classes telles que ``MboxMailbox``, ``MaildirMailbox``, ``OutlookMailbox`` " | ||||
"qui gèrent les différents formats de boîtes aux lettres spécifiques." | ||||
| ||||
#: ../Doc/faq/programming.rst:1384 | ||||
#: ../Doc/faq/programming.rst:1381 | ||||
msgid "What is a method?" | ||||
msgstr "Qu'est-ce qu'une méthode?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1386 | ||||
#: ../Doc/faq/programming.rst:1383 | ||||
msgid "" | ||||
"A method is a function on some object ``x`` that you normally call as ``x." | ||||
"name(arguments...)``. Methods are defined as functions inside the class " | ||||
| | @ -1769,11 +1765,11 @@ msgstr "" | |||
"``x.name(arguments…)``. Les méthodes sont définies comme des fonctions à " | ||||
"l'intérieur de la définition de classe ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1396 | ||||
#: ../Doc/faq/programming.rst:1393 | ||||
msgid "What is self?" | ||||
msgstr "Qu'est-ce que self?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1398 | ||||
#: ../Doc/faq/programming.rst:1395 | ||||
msgid "" | ||||
"Self is merely a conventional name for the first argument of a method. A " | ||||
"method defined as ``meth(self, a, b, c)`` should be called as ``x.meth(a, b, " | ||||
| | @ -1786,11 +1782,11 @@ msgstr "" | |||
"laquelle elle est définie, la méthode appelée considérera qu'elle est " | ||||
"appelée ``meth(x, a, b, c)``." | ||||
| ||||
#: ../Doc/faq/programming.rst:1403 | ||||
#: ../Doc/faq/programming.rst:1400 | ||||
msgid "See also :ref:`why-self`." | ||||
msgstr "Voir aussi :ref:`why-self`." | ||||
| ||||
#: ../Doc/faq/programming.rst:1407 | ||||
#: ../Doc/faq/programming.rst:1404 | ||||
msgid "" | ||||
"How do I check if an object is an instance of a given class or of a subclass " | ||||
"of it?" | ||||
| | @ -1798,7 +1794,7 @@ msgstr "" | |||
"Comment puis-je vérifier si un objet est une instance d'une classe donnée ou " | ||||
"d'une sous-classe de celui-ci?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1409 | ||||
#: ../Doc/faq/programming.rst:1406 | ||||
msgid "" | ||||
"Use the built-in function ``isinstance(obj, cls)``. You can check if an " | ||||
"object is an instance of any of a number of classes by providing a tuple " | ||||
| | @ -1813,7 +1809,7 @@ msgstr "" | |||
"objet est l'un des types natifs de Python, par exemple, ``isinstance(obj, " | ||||
"str)`` ou ``isinstance(obj, (int, float, complex))``." | ||||
| ||||
#: ../Doc/faq/programming.rst:1415 | ||||
#: ../Doc/faq/programming.rst:1412 | ||||
msgid "" | ||||
"Note that most programs do not use :func:`isinstance` on user-defined " | ||||
"classes very often. If you are developing the classes yourself, a more " | ||||
| | @ -1830,7 +1826,7 @@ msgstr "" | |||
"chose de différent en fonction de sa classe. Par exemple, si vous avez une " | ||||
"fonction qui fait quelque chose : ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1429 | ||||
#: ../Doc/faq/programming.rst:1426 | ||||
msgid "" | ||||
"A better approach is to define a ``search()`` method on all the classes and " | ||||
"just call it::" | ||||
| | @ -1838,11 +1834,11 @@ msgstr "" | |||
"Une meilleure approche est de définir une méthode ``search()`` sur toutes " | ||||
"les classes et qu'il suffit d'appeler ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1444 | ||||
#: ../Doc/faq/programming.rst:1441 | ||||
msgid "What is delegation?" | ||||
msgstr "Qu'est-ce que la délégation?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1446 | ||||
#: ../Doc/faq/programming.rst:1443 | ||||
msgid "" | ||||
"Delegation is an object oriented technique (also called a design pattern). " | ||||
"Let's say you have an object ``x`` and want to change the behaviour of just " | ||||
| | @ -1857,7 +1853,7 @@ msgstr "" | |||
"vous intéresse dans l'évolution et les délégués de toutes les autres " | ||||
"méthodes la méthode correspondante de ``x``." | ||||
| ||||
#: ../Doc/faq/programming.rst:1452 | ||||
#: ../Doc/faq/programming.rst:1449 | ||||
msgid "" | ||||
"Python programmers can easily implement delegation. For example, the " | ||||
"following class implements a class that behaves like a file but converts all " | ||||
| | @ -1867,7 +1863,7 @@ msgstr "" | |||
"Par exemple, la classe suivante implémente une classe qui se comporte comme " | ||||
"un fichier, mais convertit toutes les données écrites en majuscules ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1467 | ||||
#: ../Doc/faq/programming.rst:1464 | ||||
msgid "" | ||||
"Here the ``UpperOut`` class redefines the ``write()`` method to convert the " | ||||
"argument string to uppercase before calling the underlying ``self.__outfile." | ||||
| | @ -1883,7 +1879,7 @@ msgstr "" | |||
"``__getattr__``, consulter :ref:`the language reference <attribute-access>` " | ||||
"pour plus d'informations sur le contrôle d'accès d'attribut." | ||||
| ||||
#: ../Doc/faq/programming.rst:1474 | ||||
#: ../Doc/faq/programming.rst:1471 | ||||
msgid "" | ||||
"Note that for more general cases delegation can get trickier. When " | ||||
"attributes must be set as well as retrieved, the class must define a :meth:" | ||||
| | @ -1897,7 +1893,7 @@ msgstr "" | |||
"et il doit le faire avec soin. La mise en œuvre basique de la méthode :meth:" | ||||
"`__setattr__` est à peu près équivalent à ce qui suit ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1485 | ||||
#: ../Doc/faq/programming.rst:1482 | ||||
msgid "" | ||||
"Most :meth:`__setattr__` implementations must modify ``self.__dict__`` to " | ||||
"store local state for self without causing an infinite recursion." | ||||
| | @ -1906,7 +1902,7 @@ msgstr "" | |||
"``self.__dict__`` pour stocker l'état locale de self sans provoquer une " | ||||
"récursion infinie." | ||||
| ||||
#: ../Doc/faq/programming.rst:1490 | ||||
#: ../Doc/faq/programming.rst:1487 | ||||
msgid "" | ||||
"How do I call a method defined in a base class from a derived class that " | ||||
"overrides it?" | ||||
| | @ -1914,11 +1910,11 @@ msgstr "" | |||
"Comment appeler une méthode définie dans une classe de base depuis une " | ||||
"classe dérivée qui la surcharge?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1492 | ||||
#: ../Doc/faq/programming.rst:1489 | ||||
msgid "Use the built-in :func:`super` function::" | ||||
msgstr "Utiliser la fonction native :func:`super` : ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1498 | ||||
#: ../Doc/faq/programming.rst:1495 | ||||
msgid "" | ||||
"For version prior to 3.0, you may be using classic classes: For a class " | ||||
"definition such as ``class Derived(Base): ...`` you can call method " | ||||
| | @ -1933,13 +1929,13 @@ msgstr "" | |||
"Ici, ``Base.meth`` est une méthode non liée, vous devez donc fournir " | ||||
"l'argument ``self``." | ||||
| ||||
#: ../Doc/faq/programming.rst:1506 | ||||
#: ../Doc/faq/programming.rst:1503 | ||||
msgid "How can I organize my code to make it easier to change the base class?" | ||||
msgstr "" | ||||
"Comment puis-je organiser mon code pour permettre de changer la classe de " | ||||
"base plus facilement?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1508 | ||||
#: ../Doc/faq/programming.rst:1505 | ||||
msgid "" | ||||
"You could define an alias for the base class, assign the real base class to " | ||||
"it before your class definition, and use the alias throughout your class. " | ||||
| | @ -1955,13 +1951,13 @@ msgstr "" | |||
"voulez décider dynamiquement (par exemple en fonction de la disponibilité " | ||||
"des ressources) la classe de base à utiliser. Exemple ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1523 | ||||
#: ../Doc/faq/programming.rst:1520 | ||||
msgid "How do I create static class data and static class methods?" | ||||
msgstr "" | ||||
"Comment puis-je créer des données statiques de classe et des méthodes " | ||||
"statiques de classe?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1525 | ||||
#: ../Doc/faq/programming.rst:1522 | ||||
msgid "" | ||||
"Both static data and static methods (in the sense of C++ or Java) are " | ||||
"supported in Python." | ||||
| | @ -1969,7 +1965,7 @@ msgstr "" | |||
"Tant les données statiques que les méthodes statiques (dans le sens de C + + " | ||||
"ou Java) sont pris en charge en Python." | ||||
| ||||
#: ../Doc/faq/programming.rst:1528 | ||||
#: ../Doc/faq/programming.rst:1525 | ||||
msgid "" | ||||
"For static data, simply define a class attribute. To assign a new value to " | ||||
"the attribute, you have to explicitly use the class name in the assignment::" | ||||
| | @ -1978,7 +1974,7 @@ msgstr "" | |||
"attribuer une nouvelle valeur à l'attribut, vous devez explicitement " | ||||
"utiliser le nom de classe dans l'affectation ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1540 | ||||
#: ../Doc/faq/programming.rst:1537 | ||||
msgid "" | ||||
"``c.count`` also refers to ``C.count`` for any ``c`` such that " | ||||
"``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some " | ||||
| | @ -1989,7 +1985,7 @@ msgstr "" | |||
"une classe sur le chemin de recherche de classe de base de ``c.__class__`` " | ||||
"jusqu'à ``C``." | ||||
| ||||
#: ../Doc/faq/programming.rst:1544 | ||||
#: ../Doc/faq/programming.rst:1541 | ||||
msgid "" | ||||
"Caution: within a method of C, an assignment like ``self.count = 42`` " | ||||
"creates a new and unrelated instance named \"count\" in ``self``'s own " | ||||
| | @ -2002,11 +1998,11 @@ msgstr "" | |||
"statique de classe doit toujours spécifier la classe que l'on soit à " | ||||
"l'intérieur d'une méthode ou non ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1551 | ||||
#: ../Doc/faq/programming.rst:1548 | ||||
msgid "Static methods are possible::" | ||||
msgstr "Les méthodes statiques sont possibles : ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1559 | ||||
#: ../Doc/faq/programming.rst:1556 | ||||
msgid "" | ||||
"However, a far more straightforward way to get the effect of a static method " | ||||
"is via a simple module-level function::" | ||||
| | @ -2014,7 +2010,7 @@ msgstr "" | |||
"Cependant, d'une manière beaucoup plus simple pour obtenir l'effet d'une " | ||||
"méthode statique se fait par une simple fonction au niveau du module ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1565 | ||||
#: ../Doc/faq/programming.rst:1562 | ||||
msgid "" | ||||
"If your code is structured so as to define one class (or tightly related " | ||||
"class hierarchy) per module, this supplies the desired encapsulation." | ||||
| | @ -2023,11 +2019,11 @@ msgstr "" | |||
"hiérarchie des classes connexes) par module, ceci fournira l'encapsulation " | ||||
"souhaitée." | ||||
| ||||
#: ../Doc/faq/programming.rst:1570 | ||||
#: ../Doc/faq/programming.rst:1567 | ||||
msgid "How can I overload constructors (or methods) in Python?" | ||||
msgstr "Comment puis-je surcharger les constructeurs (ou méthodes) en Python?" | ||||
| ||||
#: ../Doc/faq/programming.rst:1572 | ||||
#: ../Doc/faq/programming.rst:1569 | ||||
msgid "" | ||||
"This answer actually applies to all methods, but the question usually comes " | ||||
"up first in the context of constructors." | ||||
| | @ -2035,11 +2031,11 @@ msgstr "" | |||
"Cette réponse s'applique en fait à toutes les méthodes, mais la question " | ||||
"vient généralement en premier dans le contexte des constructeurs." | ||||
| ||||
#: ../Doc/faq/programming.rst:1575 | ||||
#: ../Doc/faq/programming.rst:1572 | ||||
msgid "In C++ you'd write" | ||||
msgstr "In C++ you'd write" | ||||
| ||||
#: ../Doc/faq/programming.rst:1584 | ||||
#: ../Doc/faq/programming.rst:1581 | ||||
msgid "" | ||||
"In Python you have to write a single constructor that catches all cases " | ||||
"using default arguments. For example::" | ||||
| | @ -2047,29 +2043,29 @@ msgstr "" | |||
"En Python, vous devez écrire un constructeur unique qui considère tous les " | ||||
"cas en utilisant des arguments par défaut. Par exemple ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1594 | ||||
#: ../Doc/faq/programming.rst:1591 | ||||
msgid "This is not entirely equivalent, but close enough in practice." | ||||
msgstr "" | ||||
"Ce n'est pas tout à fait équivalent, mais suffisamment proche dans la " | ||||
"pratique." | ||||
| ||||
#: ../Doc/faq/programming.rst:1596 | ||||
#: ../Doc/faq/programming.rst:1593 | ||||
msgid "You could also try a variable-length argument list, e.g. ::" | ||||
msgstr "" | ||||
"Vous pouvez aussi utiliser une liste d'arguments de longueur variable, par " | ||||
"exemple : ::" | ||||
| ||||
#: ../Doc/faq/programming.rst:1601 | ||||
#: ../Doc/faq/programming.rst:1598 | ||||
msgid "The same approach works for all method definitions." | ||||
msgstr "La même approche fonctionne pour toutes les définitions de méthode." | ||||
| ||||
#: ../Doc/faq/programming.rst:1605 | ||||
#: ../Doc/faq/programming.rst:1602 | ||||
msgid "I try to use __spam and I get an error about _SomeClassName__spam." | ||||
msgstr "" | ||||
"J'essaie d'utiliser ``__spam`` et j'obtiens une erreur à propos de " | ||||
"``_SomeClassName__spam``." | ||||
| ||||
#: ../Doc/faq/programming.rst:1607 | ||||
#: ../Doc/faq/programming.rst:1604 | ||||
msgid "" | ||||
"Variable names with double leading underscores are \"mangled\" to provide a " | ||||
"simple but effective way to define class private variables. Any identifier " | ||||
| | @ -2085,7 +2081,7 @@ msgstr "" | |||
"``_classname__spam``, où ``classname`` est le nom de la classe en cours dont " | ||||
"les éventuels tirets bas ont été retirés." | ||||
| ||||
#: ../Doc/faq/programming.rst:1613 | ||||
#: ../Doc/faq/programming.rst:1610 | ||||
msgid "" | ||||
"This doesn't guarantee privacy: an outside user can still deliberately " | ||||
"access the \"_classname__spam\" attribute, and private values are visible in " | ||||
| | @ -2098,17 +2094,17 @@ msgstr "" | |||
"programmeurs Python ne prennent jamais la peine d'utiliser des noms de " | ||||
"variable privée." | ||||
| ||||
#: ../Doc/faq/programming.rst:1620 | ||||
#: ../Doc/faq/programming.rst:1617 | ||||
msgid "My class defines __del__ but it is not called when I delete the object." | ||||
msgstr "" | ||||
"Ma classe définit ``__del__`` mais il n'est pas appelé lorsque je supprime " | ||||
"l'objet." | ||||
| ||||
#: ../Doc/faq/programming.rst:1622 | ||||
#: ../Doc/faq/programming.rst:1619 | ||||
msgid "There are several possible reasons for this." | ||||
msgstr "Il y a plusieurs raisons possibles pour cela." | ||||
| ||||
#: ../Doc/faq/programming.rst:1624 | ||||
#: ../Doc/faq/programming.rst:1621 | ||||
msgid "" | ||||
"The del statement does not necessarily call :meth:`__del__` -- it simply " | ||||
"decrements the object's reference count, and if this reaches zero :meth:" | ||||
| | @ -2118,7 +2114,7 @@ msgstr "" | |||
"simplement le compteur de références de l'objet, et si celui ci arrive à " | ||||
"zéro :meth:`__del__` est appelée." | ||||
| ||||
#: ../Doc/faq/programming.rst:1628 | ||||
#: ../Doc/faq/programming.rst:1625 | ||||
msgid "" | ||||
"If your data structures contain circular links (e.g. a tree where each child " | ||||
"has a parent reference and each parent has a list of children) the reference " | ||||
| | @ -2132,7 +2128,7 @@ msgid "" | |||
"cases where objects will never be collected." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1639 | ||||
#: ../Doc/faq/programming.rst:1636 | ||||
msgid "" | ||||
"Despite the cycle collector, it's still a good idea to define an explicit " | ||||
"``close()`` method on objects to be called whenever you're done with them. " | ||||
| | @ -2142,7 +2138,7 @@ msgid "" | |||
"once for the same object." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1646 | ||||
#: ../Doc/faq/programming.rst:1643 | ||||
msgid "" | ||||
"Another way to avoid cyclical references is to use the :mod:`weakref` " | ||||
"module, which allows you to point to objects without incrementing their " | ||||
| | @ -2150,28 +2146,28 @@ msgid "" | |||
"references for their parent and sibling references (if they need them!)." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1659 | ||||
#: ../Doc/faq/programming.rst:1656 | ||||
msgid "" | ||||
"Finally, if your :meth:`__del__` method raises an exception, a warning " | ||||
"message is printed to :data:`sys.stderr`." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1664 | ||||
#: ../Doc/faq/programming.rst:1661 | ||||
msgid "How do I get a list of all instances of a given class?" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1666 | ||||
#: ../Doc/faq/programming.rst:1663 | ||||
msgid "" | ||||
"Python does not keep track of all instances of a class (or of a built-in " | ||||
"type). You can program the class's constructor to keep track of all " | ||||
"instances by keeping a list of weak references to each instance." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1672 | ||||
#: ../Doc/faq/programming.rst:1669 | ||||
msgid "Why does the result of ``id()`` appear to be not unique?" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1674 | ||||
#: ../Doc/faq/programming.rst:1671 | ||||
msgid "" | ||||
"The :func:`id` builtin returns an integer that is guaranteed to be unique " | ||||
"during the lifetime of the object. Since in CPython, this is the object's " | ||||
| | @ -2180,7 +2176,7 @@ msgid "" | |||
"memory. This is illustrated by this example:" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1685 | ||||
#: ../Doc/faq/programming.rst:1682 | ||||
msgid "" | ||||
"The two ids belong to different integer objects that are created before, and " | ||||
"deleted immediately after execution of the ``id()`` call. To be sure that " | ||||
| | @ -2188,15 +2184,15 @@ msgid "" | |||
"reference to the object:" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1698 | ||||
#: ../Doc/faq/programming.rst:1695 | ||||
msgid "Modules" | ||||
msgstr "Modules" | ||||
| ||||
#: ../Doc/faq/programming.rst:1701 | ||||
#: ../Doc/faq/programming.rst:1698 | ||||
msgid "How do I create a .pyc file?" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1703 | ||||
#: ../Doc/faq/programming.rst:1700 | ||||
msgid "" | ||||
"When a module is imported for the first time (or when the source file has " | ||||
"changed since the current compiled file was created) a ``.pyc`` file " | ||||
| | @ -2207,7 +2203,7 @@ msgid "" | |||
"particular ``python`` binary that created it. (See :pep:`3147` for details.)" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1711 | ||||
#: ../Doc/faq/programming.rst:1708 | ||||
msgid "" | ||||
"One reason that a ``.pyc`` file may not be created is a permissions problem " | ||||
"with the directory containing the source file, meaning that the " | ||||
| | @ -2216,7 +2212,7 @@ msgid "" | |||
"testing with a web server." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1716 | ||||
#: ../Doc/faq/programming.rst:1713 | ||||
msgid "" | ||||
"Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " | ||||
"creation of a .pyc file is automatic if you're importing a module and Python " | ||||
| | @ -2225,7 +2221,7 @@ msgid "" | |||
"subdirectory." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1721 | ||||
#: ../Doc/faq/programming.rst:1718 | ||||
msgid "" | ||||
"Running Python on a top level script is not considered an import and no ``." | ||||
"pyc`` will be created. For example, if you have a top-level module ``foo." | ||||
| | @ -2235,27 +2231,27 @@ msgid "" | |||
"for ``foo`` since ``foo.py`` isn't being imported." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1728 | ||||
#: ../Doc/faq/programming.rst:1725 | ||||
msgid "" | ||||
"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." | ||||
"pyc`` file for a module that is not imported -- you can, using the :mod:" | ||||
"`py_compile` and :mod:`compileall` modules." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1732 | ||||
#: ../Doc/faq/programming.rst:1729 | ||||
msgid "" | ||||
"The :mod:`py_compile` module can manually compile any module. One way is to " | ||||
"use the ``compile()`` function in that module interactively::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1738 | ||||
#: ../Doc/faq/programming.rst:1735 | ||||
msgid "" | ||||
"This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " | ||||
"location as ``foo.py`` (or you can override that with the optional parameter " | ||||
"``cfile``)." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1742 | ||||
#: ../Doc/faq/programming.rst:1739 | ||||
msgid "" | ||||
"You can also automatically compile all files in a directory or directories " | ||||
"using the :mod:`compileall` module. You can do it from the shell prompt by " | ||||
| | @ -2263,11 +2259,11 @@ msgid "" | |||
"Python files to compile::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1751 | ||||
#: ../Doc/faq/programming.rst:1748 | ||||
msgid "How do I find the current module name?" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1753 | ||||
#: ../Doc/faq/programming.rst:1750 | ||||
msgid "" | ||||
"A module can find out its own module name by looking at the predefined " | ||||
"global variable ``__name__``. If this has the value ``'__main__'``, the " | ||||
| | @ -2276,76 +2272,76 @@ msgid "" | |||
"only execute this code after checking ``__name__``::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1768 | ||||
#: ../Doc/faq/programming.rst:1765 | ||||
msgid "How can I have modules that mutually import each other?" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1770 | ||||
#: ../Doc/faq/programming.rst:1767 | ||||
msgid "Suppose you have the following modules:" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1772 | ||||
#: ../Doc/faq/programming.rst:1769 | ||||
msgid "foo.py::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1777 | ||||
#: ../Doc/faq/programming.rst:1774 | ||||
msgid "bar.py::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1782 | ||||
#: ../Doc/faq/programming.rst:1779 | ||||
msgid "The problem is that the interpreter will perform the following steps:" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1784 | ||||
#: ../Doc/faq/programming.rst:1781 | ||||
msgid "main imports foo" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1785 | ||||
#: ../Doc/faq/programming.rst:1782 | ||||
msgid "Empty globals for foo are created" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1786 | ||||
#: ../Doc/faq/programming.rst:1783 | ||||
msgid "foo is compiled and starts executing" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1787 | ||||
#: ../Doc/faq/programming.rst:1784 | ||||
msgid "foo imports bar" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1788 | ||||
#: ../Doc/faq/programming.rst:1785 | ||||
msgid "Empty globals for bar are created" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1789 | ||||
#: ../Doc/faq/programming.rst:1786 | ||||
msgid "bar is compiled and starts executing" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1790 | ||||
#: ../Doc/faq/programming.rst:1787 | ||||
msgid "" | ||||
"bar imports foo (which is a no-op since there already is a module named foo)" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1791 | ||||
#: ../Doc/faq/programming.rst:1788 | ||||
msgid "bar.foo_var = foo.foo_var" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1793 | ||||
#: ../Doc/faq/programming.rst:1790 | ||||
msgid "" | ||||
"The last step fails, because Python isn't done with interpreting ``foo`` yet " | ||||
"and the global symbol dictionary for ``foo`` is still empty." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1796 | ||||
#: ../Doc/faq/programming.rst:1793 | ||||
msgid "" | ||||
"The same thing happens when you use ``import foo``, and then try to access " | ||||
"``foo.foo_var`` in global code." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1799 | ||||
#: ../Doc/faq/programming.rst:1796 | ||||
msgid "There are (at least) three possible workarounds for this problem." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1801 | ||||
#: ../Doc/faq/programming.rst:1798 | ||||
msgid "" | ||||
"Guido van Rossum recommends avoiding all uses of ``from <module> import ..." | ||||
"``, and placing all code inside functions. Initializations of global " | ||||
| | @ -2354,59 +2350,59 @@ msgid "" | |||
"``<module>.<name>``." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1806 | ||||
#: ../Doc/faq/programming.rst:1803 | ||||
msgid "" | ||||
"Jim Roskind suggests performing steps in the following order in each module:" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1808 | ||||
#: ../Doc/faq/programming.rst:1805 | ||||
msgid "" | ||||
"exports (globals, functions, and classes that don't need imported base " | ||||
"classes)" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1810 | ||||
#: ../Doc/faq/programming.rst:1807 | ||||
msgid "``import`` statements" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1811 | ||||
#: ../Doc/faq/programming.rst:1808 | ||||
msgid "" | ||||
"active code (including globals that are initialized from imported values)." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1813 | ||||
#: ../Doc/faq/programming.rst:1810 | ||||
msgid "" | ||||
"van Rossum doesn't like this approach much because the imports appear in a " | ||||
"strange place, but it does work." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1816 | ||||
#: ../Doc/faq/programming.rst:1813 | ||||
msgid "" | ||||
"Matthias Urlichs recommends restructuring your code so that the recursive " | ||||
"import is not necessary in the first place." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1819 | ||||
#: ../Doc/faq/programming.rst:1816 | ||||
msgid "These solutions are not mutually exclusive." | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1823 | ||||
#: ../Doc/faq/programming.rst:1820 | ||||
msgid "__import__('x.y.z') returns <module 'x'>; how do I get z?" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1825 | ||||
#: ../Doc/faq/programming.rst:1822 | ||||
msgid "" | ||||
"Consider using the convenience function :func:`~importlib.import_module` " | ||||
"from :mod:`importlib` instead::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1832 | ||||
#: ../Doc/faq/programming.rst:1829 | ||||
msgid "" | ||||
"When I edit an imported module and reimport it, the changes don't show up. " | ||||
"Why does this happen?" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1834 | ||||
#: ../Doc/faq/programming.rst:1831 | ||||
msgid "" | ||||
"For reasons of efficiency as well as consistency, Python only reads the " | ||||
"module file on the first time a module is imported. If it didn't, in a " | ||||
| | @ -2415,13 +2411,13 @@ msgid "" | |||
"re-reading of a changed module, do this::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1844 | ||||
#: ../Doc/faq/programming.rst:1841 | ||||
msgid "" | ||||
"Warning: this technique is not 100% fool-proof. In particular, modules " | ||||
"containing statements like ::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1849 | ||||
#: ../Doc/faq/programming.rst:1846 | ||||
msgid "" | ||||
"will continue to work with the old version of the imported objects. If the " | ||||
"module contains class definitions, existing class instances will *not* be " | ||||
| | @ -2429,12 +2425,15 @@ msgid "" | |||
"paradoxical behaviour::" | ||||
msgstr "" | ||||
| ||||
#: ../Doc/faq/programming.rst:1862 | ||||
#: ../Doc/faq/programming.rst:1859 | ||||
msgid "" | ||||
"The nature of the problem is made clear if you print out the \"identity\" of " | ||||
"the class objects::" | ||||
msgstr "" | ||||
| ||||
#~ msgid "Dictionaries" | ||||
#~ msgstr "Dictionnaires" | ||||
| ||||
#~ msgid "" | ||||
#~ "How can I get a dictionary to store and display its keys in a consistent " | ||||
#~ "order?" | ||||
| | | |||
Loading…
Add table
Add a link
Reference in a new issue