1
0
Fork 0

Traduction de faq/programming.rst (#1717)

Co-authored-by: Julien Palard <julien@palard.fr>
This commit is contained in:
Jean-Abou-Samra 2021-10-22 15:34:35 +02:00 committed by GitHub
parent cce81d7f7b
commit 78a89988a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 135 additions and 46 deletions

View File

@ -6,14 +6,14 @@ msgstr ""
"Project-Id-Version: Python 3\n" "Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-21 15:04+0200\n" "POT-Creation-Date: 2021-10-21 15:04+0200\n"
"PO-Revision-Date: 2021-05-19 22:42+0200\n" "PO-Revision-Date: 2021-10-17 02:06+0200\n"
"Last-Translator: Jules Lasne <jules.lasne@gmail.com>\n" "Last-Translator: Jean Abou Samra <jean@abou-samra.fr>\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n" "Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n" "X-Generator: Poedit 3.0\n"
#: faq/programming.rst:5 #: faq/programming.rst:5
msgid "Programming FAQ" msgid "Programming FAQ"
@ -70,7 +70,6 @@ msgstr ""
"idle``) contient un débogueur graphique." "idle``) contient un débogueur graphique."
#: faq/programming.rst:31 #: faq/programming.rst:31
#, fuzzy
msgid "" msgid ""
"PythonWin is a Python IDE that includes a GUI debugger based on pdb. The " "PythonWin is a Python IDE that includes a GUI debugger based on pdb. The "
"PythonWin debugger colors breakpoints and has quite a few cool features such " "PythonWin debugger colors breakpoints and has quite a few cool features such "
@ -83,10 +82,9 @@ msgstr ""
"embarque un débogueur graphique basé sur ``pdb``. Le débogueur *PythonWin* " "embarque un débogueur graphique basé sur ``pdb``. Le débogueur *PythonWin* "
"colore les points d'arrêts et possède quelques fonctionnalités sympathiques, " "colore les points d'arrêts et possède quelques fonctionnalités sympathiques, "
"comme la possibilité de déboguer des programmes développés sans " "comme la possibilité de déboguer des programmes développés sans "
"*PythonWin*. *PythonWin* est disponible dans le projet `Extensions Python " "*PythonWin*. *PythonWin* est disponible dans le projet `pywin32 <https://"
"pour Windows <https://sourceforge.net/projects/pywin32/>`__ et fait partie " "github.com/mhammond/pywin32>`_ et fait partie de la distribution "
"de la distribution ActivePython (voir https://www.activestate.com/" "`ActivePython <https://www.activestate.com/products/python/>`_."
"activepython\\ )."
#: faq/programming.rst:38 #: faq/programming.rst:38
msgid "" msgid ""
@ -101,12 +99,17 @@ msgid ""
"`trepan3k <https://github.com/rocky/python3-trepan/>`_ is a gdb-like " "`trepan3k <https://github.com/rocky/python3-trepan/>`_ is a gdb-like "
"debugger." "debugger."
msgstr "" msgstr ""
"`trepan3k <https://github.com/rocky/python3-trepan/>`_ est un débogueur "
"semblable à GDB."
#: faq/programming.rst:43 #: faq/programming.rst:43
msgid "" msgid ""
"`Visual Studio Code <https://code.visualstudio.com/>`_ is an IDE with " "`Visual Studio Code <https://code.visualstudio.com/>`_ is an IDE with "
"debugging tools that integrates with version-control software." "debugging tools that integrates with version-control software."
msgstr "" msgstr ""
"`Visual Studio Code <https://code.visualstudio.com/>`_ est un EDI qui "
"contient des outils de débogage. Il sait interagir avec les outils de "
"gestion de version."
#: faq/programming.rst:46 #: faq/programming.rst:46
msgid "" msgid ""
@ -114,20 +117,19 @@ msgid ""
"debuggers. They include:" "debuggers. They include:"
msgstr "" msgstr ""
"Il existe de nombreux EDI Python propriétaires qui embarquent un débogueur " "Il existe de nombreux EDI Python propriétaires qui embarquent un débogueur "
"graphique. Notamment :" "graphique, notamment :"
#: faq/programming.rst:49 #: faq/programming.rst:49
msgid "`Wing IDE <https://wingware.com/>`_" msgid "`Wing IDE <https://wingware.com/>`_"
msgstr "`Wing IDE <https://wingware.com/>`_" msgstr "`Wing IDE <https://wingware.com/>`_ ;"
#: faq/programming.rst:50 #: faq/programming.rst:50
msgid "`Komodo IDE <https://www.activestate.com/products/komodo-ide/>`_" msgid "`Komodo IDE <https://www.activestate.com/products/komodo-ide/>`_"
msgstr "" msgstr "`Komodo IDE <https://www.activestate.com/products/komodo-ide/>`_ ;"
#: faq/programming.rst:51 #: faq/programming.rst:51
#, fuzzy
msgid "`PyCharm <https://www.jetbrains.com/pycharm/>`_" msgid "`PyCharm <https://www.jetbrains.com/pycharm/>`_"
msgstr "PyCharm (https://www.jetbrains.com/pycharm/)" msgstr "`PyCharm <https://www.jetbrains.com/pycharm/>`_ ;"
#: faq/programming.rst:55 #: faq/programming.rst:55
msgid "Are there tools to help find bugs or perform static analysis?" msgid "Are there tools to help find bugs or perform static analysis?"
@ -215,33 +217,40 @@ msgid ""
"The following packages can help with the creation of console and GUI " "The following packages can help with the creation of console and GUI "
"executables:" "executables:"
msgstr "" msgstr ""
"Voici quelques paquets qui permettent de créer des exécutables en ligne de "
"commande comme graphiques :"
#: faq/programming.rst:97 #: faq/programming.rst:97
msgid "`Nuitka <https://nuitka.net/>`_ (Cross-platform)" msgid "`Nuitka <https://nuitka.net/>`_ (Cross-platform)"
msgstr "" msgstr "`Nuitka <https://nuitka.net/>`_ (multi-plateforme) ;"
#: faq/programming.rst:98 #: faq/programming.rst:98
msgid "`PyInstaller <http://www.pyinstaller.org/>`_ (Cross-platform)" msgid "`PyInstaller <http://www.pyinstaller.org/>`_ (Cross-platform)"
msgstr "" msgstr "`PyInstaller <http://www.pyinstaller.org/>`_ (multi-plateforme) ;"
#: faq/programming.rst:99 #: faq/programming.rst:99
msgid "" msgid ""
"`PyOxidizer <https://pyoxidizer.readthedocs.io/en/stable/>`_ (Cross-platform)" "`PyOxidizer <https://pyoxidizer.readthedocs.io/en/stable/>`_ (Cross-platform)"
msgstr "" msgstr ""
"`PyOxidizer <https://pyoxidizer.readthedocs.io/en/stable/>`_ (multi-"
"plateforme) ;"
#: faq/programming.rst:100 #: faq/programming.rst:100
msgid "" msgid ""
"`cx_Freeze <https://marcelotduarte.github.io/cx_Freeze/>`_ (Cross-platform)" "`cx_Freeze <https://marcelotduarte.github.io/cx_Freeze/>`_ (Cross-platform)"
msgstr "" msgstr ""
"`cx_Freeze <https://marcelotduarte.github.io/cx_Freeze/>`_ (multi-"
"plateforme) ;"
#: faq/programming.rst:101 #: faq/programming.rst:101
msgid "`py2app <https://github.com/ronaldoussoren/py2app>`_ (macOS only)" msgid "`py2app <https://github.com/ronaldoussoren/py2app>`_ (macOS only)"
msgstr "" msgstr ""
"`py2app <https://github.com/ronaldoussoren/py2app>`_ (uniquement pour "
"macOS) ;"
#: faq/programming.rst:102 #: faq/programming.rst:102
#, fuzzy
msgid "`py2exe <http://www.py2exe.org/>`_ (Windows only)" msgid "`py2exe <http://www.py2exe.org/>`_ (Windows only)"
msgstr "http://www.py2exe.org/" msgstr "`py2exe <http://www.py2exe.org/>`_ (uniquement pour Windows)."
#: faq/programming.rst:105 #: faq/programming.rst:105
msgid "Are there coding standards or a style guide for Python programs?" msgid "Are there coding standards or a style guide for Python programs?"
@ -1868,7 +1877,6 @@ msgstr ""
"différents types." "différents types."
#: faq/programming.rst:1206 #: faq/programming.rst:1206
#, fuzzy
msgid "" msgid ""
"The ``array`` module also provides methods for creating arrays of fixed " "The ``array`` module also provides methods for creating arrays of fixed "
"types with compact representations, but they are slower to index than " "types with compact representations, but they are slower to index than "
@ -1877,9 +1885,8 @@ msgid ""
msgstr "" msgstr ""
"Le module ``array`` fournit des méthodes pour créer des tableaux de types " "Le module ``array`` fournit des méthodes pour créer des tableaux de types "
"fixes dans une représentation compacte, mais ils sont plus lents à indexer " "fixes dans une représentation compacte, mais ils sont plus lents à indexer "
"que les listes. Notez aussi que l'extension ``Numeric`` (et d'autres) " "que les listes. Notez aussi que NumPy (et d'autres) fournissent différentes "
"fournissent différentes structures de type tableaux, avec des " "structures de type tableaux, avec des caractéristiques différentes."
"caractéristiques différentes."
#: faq/programming.rst:1211 #: faq/programming.rst:1211
msgid "" msgid ""
@ -2225,6 +2232,12 @@ msgid ""
"registered class even if hasn't directly or indirectly inherited from it. " "registered class even if hasn't directly or indirectly inherited from it. "
"To test for \"true inheritance\", scan the :term:`MRO` of the class:" "To test for \"true inheritance\", scan the :term:`MRO` of the class:"
msgstr "" msgstr ""
"Notez que :func:`isinstance` prend aussi en compte l'héritage virtuel d'une :"
"term:`classe de base abstraite <abstract base class>`, c'est à dire qu'elle "
"renvoie ``True`` pour une classe A enregistrée auprès d'une classe de base "
"abstraite B même si A n'est pas directement ou indirectement une classe "
"fille de B. Pour vérifier l'héritage dans le sens plus restreint, parcourez "
"l'\\ :term:`ordre de résolution des méthodes <MRO>` de la classe :"
#: faq/programming.rst:1483 #: faq/programming.rst:1483
msgid "" msgid ""
@ -2320,7 +2333,6 @@ msgstr ""
"récursion infinie." "récursion infinie."
#: faq/programming.rst:1558 #: faq/programming.rst:1558
#, fuzzy
msgid "" msgid ""
"How do I call a method defined in a base class from a derived class that " "How do I call a method defined in a base class from a derived class that "
"extends it?" "extends it?"
@ -2339,6 +2351,11 @@ msgid ""
"resolution order` (MRO) with ``type(self).__mro__``, and return the next in " "resolution order` (MRO) with ``type(self).__mro__``, and return the next in "
"line after ``Derived`` in the MRO: ``Base``." "line after ``Derived`` in the MRO: ``Base``."
msgstr "" msgstr ""
"Dans cet exemple, :func:`super` détermine automatiquement l'instance dont "
"une méthode l'appelle (l'objet ``self``), observe l'\\ :term:`ordre de "
"résolution des méthodes <method resolution order>` obtenu avec ``type(self)."
"__mro__``, et renvoie la classe qui suit ``Derived`` dans cet ordre, donc "
"``Base``."
#: faq/programming.rst:1573 #: faq/programming.rst:1573
msgid "How can I organize my code to make it easier to change the base class?" msgid "How can I organize my code to make it easier to change the base class?"
@ -2634,13 +2651,15 @@ msgstr ""
#: faq/programming.rst:1765 #: faq/programming.rst:1765
msgid "When can I rely on identity tests with the *is* operator?" msgid "When can I rely on identity tests with the *is* operator?"
msgstr "" msgstr "Quand puis-je raisonnablement utiliser le test d'identité *is* ?"
#: faq/programming.rst:1767 #: faq/programming.rst:1767
msgid "" msgid ""
"The ``is`` operator tests for object identity. The test ``a is b`` is " "The ``is`` operator tests for object identity. The test ``a is b`` is "
"equivalent to ``id(a) == id(b)``." "equivalent to ``id(a) == id(b)``."
msgstr "" msgstr ""
"L'opérateur ``is`` détermine si deux objets sont identiques, c'est à dire le "
"même objet. Le test ``a is b`` est équivalent à ``id(a) == id(b)``."
#: faq/programming.rst:1770 #: faq/programming.rst:1770
msgid "" msgid ""
@ -2649,6 +2668,11 @@ msgid ""
"usually faster than equality tests. And unlike equality tests, identity " "usually faster than equality tests. And unlike equality tests, identity "
"tests are guaranteed to return a boolean ``True`` or ``False``." "tests are guaranteed to return a boolean ``True`` or ``False``."
msgstr "" msgstr ""
"La propriété la plus importante du test d'identité est qu'un objet est "
"toujours identique à lui-même. Quel que soit la valeur de *a*, ``a is a`` "
"vaut toujours ``True``. Un test d'identité est généralement plus rapide "
"qu'un test d'égalité. De plus, contrairement à l'opérateur ``==``, "
"l'opérateur ``is`` renvoie toujours un booléen, ``True`` ou ``False``."
#: faq/programming.rst:1775 #: faq/programming.rst:1775
msgid "" msgid ""
@ -2656,12 +2680,18 @@ msgid ""
"object identity is assured. Generally, there are three circumstances where " "object identity is assured. Generally, there are three circumstances where "
"identity is guaranteed:" "identity is guaranteed:"
msgstr "" msgstr ""
"Cependant, les tests d'identité ne peuvent remplacer les tests d'égalité que "
"si l'identité est garantie. C'est le cas dans les trois situations "
"suivantes :"
#: faq/programming.rst:1779 #: faq/programming.rst:1779
msgid "" msgid ""
"1) Assignments create new names but do not change object identity. After " "1) Assignments create new names but do not change object identity. After "
"the assignment ``new = old``, it is guaranteed that ``new is old``." "the assignment ``new = old``, it is guaranteed that ``new is old``."
msgstr "" msgstr ""
"1) Les affectations créent de nouvelles variables, mais pas de nouveaux "
"objets. Après l'affectation ``nouveau = ancien``, ``nouveau is ancien`` "
"vaudra toujours ``True``."
#: faq/programming.rst:1782 #: faq/programming.rst:1782
msgid "" msgid ""
@ -2669,6 +2699,10 @@ msgid ""
"change object identity. After the list assignment ``s[0] = x``, it is " "change object identity. After the list assignment ``s[0] = x``, it is "
"guaranteed that ``s[0] is x``." "guaranteed that ``s[0] is x``."
msgstr "" msgstr ""
"Le stockage d'un objet dans un conteneur qui fonctionne avec des références "
"n'altère pas l'identité. Si ``s`` est une liste, alors après l'affectation "
"de *x* à l'indice 0, ``s[0] = x``, le test ``s[0] is x`` s'évalue forcément "
"à ``True``."
#: faq/programming.rst:1786 #: faq/programming.rst:1786
msgid "" msgid ""
@ -2676,6 +2710,9 @@ msgid ""
"object can exist. After the assignments ``a = None`` and ``b = None``, it " "object can exist. After the assignments ``a = None`` and ``b = None``, it "
"is guaranteed that ``a is b`` because ``None`` is a singleton." "is guaranteed that ``a is b`` because ``None`` is a singleton."
msgstr "" msgstr ""
"3) Les singletons sont des objets spéciaux qui ne sont jamais dupliqués. "
"Après les affectations ``a = None`` et ``b = None``, on a forcément ``a is "
"b``, puisque ``None`` est un singleton."
#: faq/programming.rst:1790 #: faq/programming.rst:1790
msgid "" msgid ""
@ -2684,16 +2721,26 @@ msgid ""
"check constants such as :class:`int` and :class:`str` which aren't " "check constants such as :class:`int` and :class:`str` which aren't "
"guaranteed to be singletons::" "guaranteed to be singletons::"
msgstr "" msgstr ""
"Dans la plupart des autres cas, un test d'identité n'est pas approprié par "
"rapport à un test d'égalité. En particulier, il ne faut pas utiliser ``is`` "
"pour comparer à des constantes comme les entiers (type :class:`int`) ou des "
"chaînes de caractères (type :class:`str`) car ces valeurs ne sont pas "
"nécessairement des singletons :"
#: faq/programming.rst:1807 #: faq/programming.rst:1807
msgid "Likewise, new instances of mutable containers are never identical::" msgid "Likewise, new instances of mutable containers are never identical::"
msgstr "" msgstr ""
"De même, deux instances fraîchement créées d'un type de conteneurs muables "
"ne sont jamais identiques :"
#: faq/programming.rst:1814 #: faq/programming.rst:1814
msgid "" msgid ""
"In the standard library code, you will see several common patterns for " "In the standard library code, you will see several common patterns for "
"correctly using identity tests:" "correctly using identity tests:"
msgstr "" msgstr ""
"Voici quelques exemples de la bibliothèque standard qui illustrent comment "
"utiliser correctement les tests d'identité dans certaines situations "
"particulières :"
#: faq/programming.rst:1817 #: faq/programming.rst:1817
msgid "" msgid ""
@ -2702,6 +2749,10 @@ msgid ""
"confusion with other objects that may have boolean values that evaluate to " "confusion with other objects that may have boolean values that evaluate to "
"false." "false."
msgstr "" msgstr ""
"1) Comme recommandé par la :pep:`8`, il est préférable de comparer avec "
"``None`` par identité. Le test se lit comme de la prose anglaise (``x is "
"None``, ``x is not None``), et cela évite des surprises avec les objets dont "
"la valeur booléenne est ``False``."
#: faq/programming.rst:1821 #: faq/programming.rst:1821
msgid "" msgid ""
@ -2710,6 +2761,11 @@ msgid ""
"guaranteed to be distinct from other objects. For example, here is how to " "guaranteed to be distinct from other objects. For example, here is how to "
"implement a method that behaves like :meth:`dict.pop`::" "implement a method that behaves like :meth:`dict.pop`::"
msgstr "" msgstr ""
"2) Savoir si un paramètre facultatif a été passé ou pas peut nécessiter un "
"peu de subtilité lorsque ``None`` est une valeur acceptable pour le "
"paramètre. Dans ces cas, il faut créer un objet singleton dit "
 sentinelle », distinct de toute valeur acceptable. Voici par exemple "
"comment écrire une méthode qui émule :meth:`dict.pop` :"
#: faq/programming.rst:1837 #: faq/programming.rst:1837
msgid "" msgid ""
@ -2717,17 +2773,24 @@ msgid ""
"identity tests. This prevents the code from being confused by objects such " "identity tests. This prevents the code from being confused by objects such "
"as ``float('NaN')`` that are not equal to themselves." "as ``float('NaN')`` that are not equal to themselves."
msgstr "" msgstr ""
"3) Il arrive que l'implémentation d'un type de conteneurs doive ajouter des "
"tests d'identité aux tests d'égalité, ceci afin d'éviter un comportement non "
"souhaité avec les objets comme ``float('NaN')`` qui ne sont pas égaux à eux-"
"mêmes."
#: faq/programming.rst:1841 #: faq/programming.rst:1841
msgid "" msgid ""
"For example, here is the implementation of :meth:`collections.abc.Sequence." "For example, here is the implementation of :meth:`collections.abc.Sequence."
"__contains__`::" "__contains__`::"
msgstr "" msgstr ""
"Par exemple, l'implémentation de :meth:`collections.abc.Sequence."
"__contains__` est :"
#: faq/programming.rst:1852 #: faq/programming.rst:1852
msgid "" msgid ""
"How can a subclass control what data is stored in an immutable instance?" "How can a subclass control what data is stored in an immutable instance?"
msgstr "" msgstr ""
"Comment définir dans une classe fille les attributs d'une instance immuable ?"
#: faq/programming.rst:1854 #: faq/programming.rst:1854
msgid "" msgid ""
@ -2736,21 +2799,27 @@ msgid ""
"instance is created, which is too late to alter data in an immutable " "instance is created, which is too late to alter data in an immutable "
"instance." "instance."
msgstr "" msgstr ""
"Lorsque l'on crée une classe héritant d'une classe d'objets immuables, il "
"faut remplacer la méthode :meth:`__new__`, et non pas la méthode :meth:"
"`__init__`. En effet, cette dernière est exécutée seulement après que "
"l'instance soit créée, donc il y est trop tard pour modifier le contenu "
"d'une instance si elle est immuable."
#: faq/programming.rst:1859 #: faq/programming.rst:1859
msgid "" msgid ""
"All of these immutable classes have a different signature than their parent " "All of these immutable classes have a different signature than their parent "
"class:" "class:"
msgstr "" msgstr ""
"Toutes les classes d'objets immuables suivantes ont des signatures de "
"constructeur différentes de leur classe mère :"
#: faq/programming.rst:1885 #: faq/programming.rst:1885
msgid "The classes can be used like this:" msgid "The classes can be used like this:"
msgstr "" msgstr "Ces classes s'utilisent comme ceci :"
#: faq/programming.rst:1900 #: faq/programming.rst:1900
#, fuzzy
msgid "How do I cache method calls?" msgid "How do I cache method calls?"
msgstr "Comment créer une liste à plusieurs dimensions ?" msgstr "Comment mettre en cache le résultat d'une méthode ?"
#: faq/programming.rst:1902 #: faq/programming.rst:1902
msgid "" msgid ""
@ -2758,6 +2827,10 @@ msgid ""
"cached_property` and :func:`functools.lru_cache`. The former stores results " "cached_property` and :func:`functools.lru_cache`. The former stores results "
"at the instance level and the latter at the class level." "at the instance level and the latter at the class level."
msgstr "" msgstr ""
"Il existe deux outils principaux pour mettre en cache la valeur de retour "
"d'une méthode, à savoir :func:`functools.cached_property`, qui stocke les "
"valeurs au niveau de l'instance, et :func:`functools.lru_cache`, qui le fait "
"au niveau de la classe."
#: faq/programming.rst:1907 #: faq/programming.rst:1907
msgid "" msgid ""
@ -2765,6 +2838,9 @@ msgid ""
"arguments. It does not create a reference to the instance. The cached " "arguments. It does not create a reference to the instance. The cached "
"method result will be kept only as long as the instance is alive." "method result will be kept only as long as the instance is alive."
msgstr "" msgstr ""
"La fonction ``cached_property`` n'est applicable qu'aux méthodes sans "
"argument. Elle n'induit aucune de référence vers l'instance. Le cache est "
"simplement conservé aussi longtemps que l'instance elle-même."
#: faq/programming.rst:1911 #: faq/programming.rst:1911
msgid "" msgid ""
@ -2773,6 +2849,9 @@ msgid ""
"accumulate, so too will the accumulated method results. They can grow " "accumulate, so too will the accumulated method results. They can grow "
"without bound." "without bound."
msgstr "" msgstr ""
"L'avantage est que le cache est supprimé aussitôt que l'instance est "
"détruite. L'inconvénient est que les caches peuvent s'accumuler avec les "
"instances, sans limite de nombre."
#: faq/programming.rst:1916 #: faq/programming.rst:1916
msgid "" msgid ""
@ -2780,6 +2859,9 @@ msgid ""
"It creates a reference to the instance unless special efforts are made to " "It creates a reference to the instance unless special efforts are made to "
"pass in weak references." "pass in weak references."
msgstr "" msgstr ""
"La fonction ``lru_cache`` s'applique quant à elle aux méthodes dont les "
"arguments sont hachables. Elle crée une référence forte à l'instance, sauf à "
"passer par des circonvolutions pour que la référence soit faible."
#: faq/programming.rst:1920 #: faq/programming.rst:1920
msgid "" msgid ""
@ -2787,11 +2869,17 @@ msgid ""
"bounded by the specified *maxsize*. The disadvantage is that instances are " "bounded by the specified *maxsize*. The disadvantage is that instances are "
"kept alive until they age out of the cache or until the cache is cleared." "kept alive until they age out of the cache or until the cache is cleared."
msgstr "" msgstr ""
"L'avantage de l'algorithme LRU est d'offrir une limitation sur la taille du "
"cache, que l'on peut régler avec le paramètre *maxsize* (LRU signifie *Least "
"Recently Used* en anglais, les entrées du cache les plus anciennes sont "
"évincées pour conserver la taille). L'inconvénient est qu'une référence "
"forte vers l'instance est conservée dans le cache, ce qui maintient "
"l'instance hors de portée du ramasse-miettes jusqu'à ce que l'entrée soit "
"effacée du cache ou que le cache soit remis à zéro."
#: faq/programming.rst:1925 #: faq/programming.rst:1925
#, fuzzy
msgid "This example shows the various techniques::" msgid "This example shows the various techniques::"
msgstr "Il y a plusieurs façons de faire." msgstr "Voici une démonstration des différentes techniques :"
#: faq/programming.rst:1949 #: faq/programming.rst:1949
msgid "" msgid ""
@ -2799,6 +2887,10 @@ msgid ""
"relevant instance attributes are mutable, the *cached_property* approach " "relevant instance attributes are mutable, the *cached_property* approach "
"can't be made to work because it cannot detect changes to the attributes." "can't be made to work because it cannot detect changes to the attributes."
msgstr "" msgstr ""
"Cet exemple suppose que l'attribut *station_id* n'est jamais changé. Si les "
"attributs utilisés par la méthode sont susceptible d'être modifiés, "
"``cached_property`` ne peut pas fonctionner car elle ne peut pas détecter "
"les mutations pour invalider le cache."
#: faq/programming.rst:1954 #: faq/programming.rst:1954
msgid "" msgid ""
@ -2806,6 +2898,9 @@ msgid ""
"the *__eq__* and *__hash__* methods so the cache can detect relevant " "the *__eq__* and *__hash__* methods so the cache can detect relevant "
"attribute updates::" "attribute updates::"
msgstr "" msgstr ""
"En revanche, ``lru_cache`` est utilisable à condition de définir les "
"méthodes ``__eq__`` et ``__hash__`` pour que le cache soit à même de "
"détecter toute modification des attributs."
#: faq/programming.rst:1980 #: faq/programming.rst:1980
msgid "Modules" msgid "Modules"
@ -2947,63 +3042,57 @@ msgid "Suppose you have the following modules:"
msgstr "Considérons les modules suivants :" msgstr "Considérons les modules suivants :"
#: faq/programming.rst:2054 #: faq/programming.rst:2054
#, fuzzy
msgid ":file:`foo.py`::" msgid ":file:`foo.py`::"
msgstr "*foo.py* ::" msgstr ":file:`foo.py` :"
#: faq/programming.rst:2059 #: faq/programming.rst:2059
#, fuzzy
msgid ":file:`bar.py`::" msgid ":file:`bar.py`::"
msgstr "*bar.py* ::" msgstr ":file:`bar.py` :"
#: faq/programming.rst:2064 #: faq/programming.rst:2064
msgid "The problem is that the interpreter will perform the following steps:" msgid "The problem is that the interpreter will perform the following steps:"
msgstr "Le problème réside dans les étapes que l'interpréteur va réaliser :" msgstr "Le problème réside dans les étapes que l'interpréteur va réaliser :"
#: faq/programming.rst:2066 #: faq/programming.rst:2066
#, fuzzy
msgid "main imports ``foo``" msgid "main imports ``foo``"
msgstr "*main* importe *foo*" msgstr "*main* importe *foo* ;"
#: faq/programming.rst:2067 #: faq/programming.rst:2067
#, fuzzy
msgid "Empty globals for ``foo`` are created" msgid "Empty globals for ``foo`` are created"
msgstr "Les variables globales (vides) de *foo* sont créées" msgstr "Les variables globales (vides) de *foo* sont créées ;"
#: faq/programming.rst:2068 #: faq/programming.rst:2068
#, fuzzy
msgid "``foo`` is compiled and starts executing" msgid "``foo`` is compiled and starts executing"
msgstr "*foo* est compilé et commence à s'exécuter" msgstr "*foo* est compilé et commence à s'exécuter ;"
#: faq/programming.rst:2069 #: faq/programming.rst:2069
#, fuzzy
msgid "``foo`` imports ``bar``" msgid "``foo`` imports ``bar``"
msgstr "*foo* importe *bar*" msgstr "*foo* importe *bar* ;"
#: faq/programming.rst:2070 #: faq/programming.rst:2070
#, fuzzy
msgid "Empty globals for ``bar`` are created" msgid "Empty globals for ``bar`` are created"
msgstr "Les variables globales (vides) de *bar* sont créées" msgstr "Les variables globales (vides) de *bar* sont créées ;"
#: faq/programming.rst:2071 #: faq/programming.rst:2071
#, fuzzy
msgid "``bar`` is compiled and starts executing" msgid "``bar`` is compiled and starts executing"
msgstr "*bar* est compilé et commence à s'exécuter" msgstr "*bar* est compilé et commence à s'exécuter ;"
#: faq/programming.rst:2072 #: faq/programming.rst:2072
#, fuzzy
msgid "" msgid ""
"``bar`` imports ``foo`` (which is a no-op since there already is a module " "``bar`` imports ``foo`` (which is a no-op since there already is a module "
"named ``foo``)" "named ``foo``)"
msgstr "" msgstr ""
"*bar* importe *foo* (en réalité, rien ne passe car il y a déjà un module " "*bar* importe *foo* (en réalité, rien ne passe car il y a déjà un module "
"appelé *foo*)" "appelé *foo*) ;"
#: faq/programming.rst:2073 #: faq/programming.rst:2073
msgid "" msgid ""
"The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set "
"``bar.foo_var = foo.foo_var``" "``bar.foo_var = foo.foo_var``"
msgstr "" msgstr ""
"La machinerie des imports tente de lire *foo_var* dans les variables "
"globales de *foo* pour procéder à l'affectation ``bar.foo_var = foo."
"foo_var``."
#: faq/programming.rst:2075 #: faq/programming.rst:2075
msgid "" msgid ""