-
-
Notifications
You must be signed in to change notification settings - Fork 256
3.7 howto descriptor #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.7 howto descriptor #353
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,33 +6,34 @@ msgstr "" | |
| "Project-Id-Version: Python 3.6\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "POT-Creation-Date: 2018-09-15 21:52+0200\n" | ||
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "PO-Revision-Date: 2018-10-05 10:29+0200\n" | ||
| "Language-Team: FRENCH <traductions@lists.afpy.org>\n" | ||
| "Language: fr\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "Last-Translator: \n" | ||
| "X-Generator: Poedit 2.1.1\n" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:3 | ||
| msgid "Descriptor HowTo Guide" | ||
| msgstr "" | ||
| msgstr "Descripteur Guide HowTo" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:0 | ||
| msgid "Author" | ||
| msgstr "Auteur" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:5 | ||
| msgid "Raymond Hettinger" | ||
| msgstr "" | ||
| msgstr "Raymond Hettinger" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:0 | ||
| msgid "Contact" | ||
| msgstr "" | ||
| msgstr "Contact" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:6 | ||
| msgid "<python at rcn dot com>" | ||
| msgstr "" | ||
| msgstr "<python at rcn dot com>" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:8 | ||
| msgid "Contents" | ||
|
|
@@ -50,17 +51,25 @@ msgid "" | |
| "methods. Shows how each works by giving a pure Python equivalent and a " | ||
| "sample application." | ||
| msgstr "" | ||
| "Définit les descripteurs, résume le protocole et montre comment les " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Je ne sais pas si l'on est obligé de coller au style télégraphique de Raymond. There must be a better way ! et je tape du poing sur la table. |
||
| "descripteurs sont appelés. Examine un descripteur personnalisé et plusieurs " | ||
| "descripteurs Python intégrés, y compris les fonctions, les propriétés, les " | ||
| "méthodes statiques et les méthodes de classe. Montre comment chacun " | ||
| "fonctionne en donnant un équivalent Python pur et un exemple d'application." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:18 | ||
| msgid "" | ||
| "Learning about descriptors not only provides access to a larger toolset, it " | ||
| "creates a deeper understanding of how Python works and an appreciation for " | ||
| "the elegance of its design." | ||
| msgstr "" | ||
| "L'apprentissage des descripteurs permet non seulement d'accéder à un " | ||
| "ensemble d'outils plus vaste, mais aussi de mieux comprendre le " | ||
| "fonctionnement de Python et d'apprécier l'élégance de sa conception." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:24 | ||
| msgid "Definition and Introduction" | ||
| msgstr "" | ||
| msgstr "Définition et introduction" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:26 | ||
| msgid "" | ||
|
|
@@ -70,6 +79,11 @@ msgid "" | |
| "`__delete__`. If any of those methods are defined for an object, it is said " | ||
| "to be a descriptor." | ||
| msgstr "" | ||
| "En général, un descripteur est un attribut objet avec un \"comportement " | ||
|
oboudou marked this conversation as resolved.
|
||
| "contraignant\", dont l'accès à l'attribut a été remplacé par des méthodes " | ||
| "dans le protocole du descripteur. Ces méthodes sont : :méth:`__get__`, :" | ||
| "méth:`__set__`, et :méth:`__delete__`. Si l'une de ces méthodes est définie " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. En français, il est d'usage de ne pas mettre de virgule avant le 'et'. |
||
| "pour un objet, il s'agit d'un descripteur." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:32 | ||
| msgid "" | ||
|
|
@@ -82,6 +96,15 @@ msgid "" | |
| "method instead. Where this occurs in the precedence chain depends on which " | ||
| "descriptor methods were defined." | ||
| msgstr "" | ||
| "Le comportement par défaut pour l'accès aux attributs consiste à obtenir, " | ||
| "définir ou supprimer l'attribut du dictionnaire d'un objet. Par exemple, ' " | ||
| "'a. x' 'a une chaîne de recherche commençant par' 'a. __dict__ ['x'] ' ', " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pour 'a.x', Python commence par rechercher dans ... |
||
| "puis' 'type (a). __dict__ ['x'] ' ', et continuant à travers les classes de " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... puis continue en cherchant dans les classes .... |
||
| "base de' 'type (a) ' 'À l'exclusion des sous-classes. Si la valeur " | ||
| "recherchée est un objet définissant l'une des méthodes de descripteur, " | ||
| "Python peut substituer le comportement par défaut et appeler à la place la " | ||
| "méthode Descriptor. Lorsque cela se produit dans la chaîne de précédence " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. la méthode correspondante du descripteur. Le moment où ce comportement est adopté dépend de la chaîne de précédence et des endroits où les méthodes descripteur ont été définies. |
||
| "dépend de quelles méthodes descripteur ont été définies." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. peut-etre un |
||
|
|
||
| #: ../Doc/howto/descriptor.rst:41 | ||
| msgid "" | ||
|
|
@@ -92,29 +115,39 @@ msgid "" | |
| "underlying C-code and offer a flexible set of new tools for everyday Python " | ||
| "programs." | ||
| msgstr "" | ||
| "Les descripteurs sont un protocole puissant et à usage général. Ils sont le " | ||
| "mécanisme derrière les propriétés, les méthodes, les méthodes statiques, les " | ||
| "méthodes de classes et :func:`super()`. Ils sont utilisés dans tout Python " | ||
| "lui-même pour implémenter les nouvelles classes de style introduites dans la " | ||
| "version 2.2. Les descripteurs simplifient le code C sous-jacent et offrent " | ||
| "un ensemble flexible de nouveaux outils pour les programmes Python " | ||
| "quotidiens." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:49 | ||
| msgid "Descriptor Protocol" | ||
| msgstr "" | ||
| msgstr "Protocole descripteur" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:51 | ||
| msgid "``descr.__get__(self, obj, type=None) -> value``" | ||
| msgstr "" | ||
| msgstr "``descr.__get__(self, obj, type=None) -> value``" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:53 | ||
| msgid "``descr.__set__(self, obj, value) -> None``" | ||
| msgstr "" | ||
| msgstr "``descr.__set__(self, obj, value) -> None``" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:55 | ||
| msgid "``descr.__delete__(self, obj) -> None``" | ||
| msgstr "" | ||
| msgstr "``descr.__delete__(self, obj) -> None``" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:57 | ||
| msgid "" | ||
| "That is all there is to it. Define any of these methods and an object is " | ||
| "considered a descriptor and can override default behavior upon being looked " | ||
| "up as an attribute." | ||
| msgstr "" | ||
| "C'est tout ce qu'il y a à faire. Définissez n'importe laquelle de ces " | ||
| "méthodes et un objet est considéré comme un descripteur et peut remplacer le " | ||
| "comportement par défaut lorsqu'il est recherché comme un attribut." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:61 | ||
| msgid "" | ||
|
|
@@ -123,6 +156,11 @@ msgid "" | |
| "are called non-data descriptors (they are typically used for methods but " | ||
| "other uses are possible)." | ||
| msgstr "" | ||
| "Si un objet définit à la fois :meth:`__get__`et :meth:`__set__`, il est " | ||
| "considéré comme un descripteur de données. Les descripteurs qui ne " | ||
| "définissent que :meth:`__get__` sont appelés descripteurs *non-data* (ils " | ||
| "sont généralement utilisés pour des méthodes mais d'autres utilisations sont " | ||
| "possibles)." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:66 | ||
| msgid "" | ||
|
|
@@ -132,6 +170,13 @@ msgid "" | |
| "takes precedence. If an instance's dictionary has an entry with the same " | ||
| "name as a non-data descriptor, the dictionary entry takes precedence." | ||
| msgstr "" | ||
| "Les descripteurs de données et les descripteurs *non-data* diffèrent dans la " | ||
| "façon dont les dérogations sont calculées en ce qui concerne les entrées du " | ||
| "dictionnaire d'une instance. Si le dictionnaire d'une instance comporte une " | ||
| "entrée portant le même nom qu'un descripteur de données, le descripteur de " | ||
| "données est prioritaire. Si le dictionnaire d'une instance comporte une " | ||
| "entrée portant le même nom qu'un descripteur *non-data*, l'entrée du " | ||
| "dictionnaire a la priorité." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:72 | ||
| msgid "" | ||
|
|
@@ -140,6 +185,10 @@ msgid "" | |
| "called. Defining the :meth:`__set__` method with an exception raising " | ||
| "placeholder is enough to make it a data descriptor." | ||
| msgstr "" | ||
| "To make a read-only data descriptor, define both :meth:`__get__` and :meth:" | ||
| "`__set__` with the :meth:`__set__` raising an :exc:`AttributeError` when " | ||
| "called. Defining the :meth:`__set__` method with an exception raising " | ||
| "placeholder is enough to make it a data descriptor." | ||
|
oboudou marked this conversation as resolved.
Outdated
|
||
|
|
||
| #: ../Doc/howto/descriptor.rst:79 | ||
| msgid "Invoking Descriptors" | ||
|
|
@@ -150,6 +199,8 @@ msgid "" | |
| "A descriptor can be called directly by its method name. For example, ``d." | ||
| "__get__(obj)``." | ||
| msgstr "" | ||
| "Un descripteur peut être appelé directement par son nom de méthode. Par " | ||
| "exemple, \"d.__get__(obj)`\"." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:84 | ||
| msgid "" | ||
|
|
@@ -159,11 +210,18 @@ msgid "" | |
| "then ``d.__get__(obj)`` is invoked according to the precedence rules listed " | ||
| "below." | ||
| msgstr "" | ||
| "Alternativement, il est plus courant qu'un descripteur soit invoqué " | ||
| "automatiquement lors de l'accès aux attributs. Par exemple, \"obj.d\" " | ||
| "recherche \"d\" dans le dictionnaire de \"obj.d\". Si ``d`` définit la " | ||
| "méthode :meth:`__get__get__`, alors ``d.__get__(obj)`` est invoqué selon les " | ||
|
oboudou marked this conversation as resolved.
Outdated
|
||
| "règles de priorité énumérées ci-dessous." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:89 | ||
| msgid "" | ||
| "The details of invocation depend on whether ``obj`` is an object or a class." | ||
| msgstr "" | ||
| "Les détails de l'invocation dépendent du fait que ``obj`` est un objet ou " | ||
| "une classe." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:91 | ||
| msgid "" | ||
|
|
@@ -175,39 +233,56 @@ msgid "" | |
| "The full C implementation can be found in :c:func:" | ||
| "`PyObject_GenericGetAttr()` in :source:`Objects/object.c`." | ||
| msgstr "" | ||
| "Pour les objets, la machinerie est en :meth:`object.__getattribute__` qui " | ||
| "transforme ``b.x`` en ``type(b).__dict__['x'].__get__(b, type(b)]``. " | ||
| "L'implémentation fonctionne à travers une chaîne de priorité qui donne la " | ||
| "priorité aux descripteurs de données sur les variables d'instance, la " | ||
| "priorité aux variables d'instance sur les descripteurs *non-data*, et " | ||
| "attribue la priorité la plus faible à :meth:`__getattr__` si fourni. " | ||
| "L'implémentation complète de C peut être trouvée dans :c:func:" | ||
| "`PyObject_GenericGetAttr()` dans :source:`Objects/object.c`." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:99 | ||
| msgid "" | ||
| "For classes, the machinery is in :meth:`type.__getattribute__` which " | ||
| "transforms ``B.x`` into ``B.__dict__['x'].__get__(None, B)``. In pure " | ||
| "Python, it looks like::" | ||
| msgstr "" | ||
| "Pour les classes, la machine est en :meth:`type.__getattribute__` qui " | ||
|
oboudou marked this conversation as resolved.
Outdated
|
||
| "transforme ``B.x``en ``B.__dict__['x'].__get__(None, B)``. En Python pur, " | ||
| "il ressemble à: :" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:110 | ||
| msgid "The important points to remember are:" | ||
| msgstr "" | ||
| msgstr "Les points importants à retenir sont :" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:112 | ||
| msgid "descriptors are invoked by the :meth:`__getattribute__` method" | ||
| msgstr "" | ||
| msgstr "les descripteurs sont appelés par la méthode :meth:`__getattribute__`" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:113 | ||
| msgid "overriding :meth:`__getattribute__` prevents automatic descriptor calls" | ||
| msgstr "" | ||
| "redéfinition :méth:`__getattribute____` empêche les appels automatiques de " | ||
| "descripteurs" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:114 | ||
| msgid "" | ||
| ":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make " | ||
| "different calls to :meth:`__get__`." | ||
| msgstr "" | ||
| ":méth:`objet.__getattribute__` et :méth:`type.__getattribute__` font " | ||
| "différents appels à:méth:`__get__`." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. il manque un espace apres |
||
|
|
||
| #: ../Doc/howto/descriptor.rst:116 | ||
| msgid "data descriptors always override instance dictionaries." | ||
| msgstr "" | ||
| msgstr "data descriptors always override instance dictionaries." | ||
|
oboudou marked this conversation as resolved.
Outdated
|
||
|
|
||
| #: ../Doc/howto/descriptor.rst:117 | ||
| msgid "non-data descriptors may be overridden by instance dictionaries." | ||
| msgstr "" | ||
| "les descripteurs *non-data* peuvent être remplacés par des dictionnaires " | ||
| "d'instance." | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:119 | ||
| msgid "" | ||
|
|
@@ -258,7 +333,7 @@ msgstr "" | |
|
|
||
| #: ../Doc/howto/descriptor.rst:188 | ||
| msgid "Properties" | ||
| msgstr "" | ||
| msgstr "Propriétés" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:190 | ||
| msgid "" | ||
|
|
@@ -296,7 +371,7 @@ msgstr "" | |
|
|
||
| #: ../Doc/howto/descriptor.rst:263 | ||
| msgid "Functions and Methods" | ||
| msgstr "" | ||
| msgstr "Fonctions et méthodes" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:265 | ||
| msgid "" | ||
|
|
@@ -329,7 +404,7 @@ msgstr "" | |
|
|
||
| #: ../Doc/howto/descriptor.rst:326 | ||
| msgid "Static Methods and Class Methods" | ||
| msgstr "" | ||
| msgstr "Méthodes statiques et méthodes de classe" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:328 | ||
| msgid "" | ||
|
|
@@ -366,8 +441,9 @@ msgid "function" | |
| msgstr "fonction" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:342 | ||
| #, fuzzy | ||
| msgid "f(obj, \\*args)" | ||
| msgstr "" | ||
| msgstr "``descr.__delete__(self, obj) -> None``" | ||
|
|
||
| #: ../Doc/howto/descriptor.rst:342 ../Doc/howto/descriptor.rst:344 | ||
| msgid "f(\\*args)" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guide pour l'utilisation des descripteurs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merci