# SOME DESCRIPTIVE TITLE. # Copyright (C) 1990-2016, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 2.7\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-10-30 10:44+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../Doc/howto/descriptor.rst:3 msgid "Descriptor HowTo Guide" msgstr "Guide pour l'utilisation des descripteurs" #: ../Doc/howto/descriptor.rst:5 msgid "Raymond Hettinger" msgstr "Raymond Hettinger" #: ../Doc/howto/descriptor.rst:6 msgid "" msgstr "" #: ../Doc/howto/descriptor.rst:0 msgid "Contents" msgstr "Sommaire" #: ../Doc/howto/descriptor.rst:11 msgid "Abstract" msgstr "Résumé" #: ../Doc/howto/descriptor.rst:13 msgid "" "Defines descriptors, summarizes the protocol, and shows how descriptors are " "called. Examines a custom descriptor and several built-in python " "descriptors including functions, properties, static methods, and class " "methods. Shows how each works by giving a pure Python equivalent and a " "sample application." msgstr "" #: ../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 "Définition et introduction" #: ../Doc/howto/descriptor.rst:26 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " "protocol. Those methods are :meth:`__get__`, :meth:`__set__`, and :meth:" "`__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 " "contraignant\", dont l'accès à l'attribut a été remplacé par des méthodes " "dans le protocole du descripteur. Ces méthodes sont : :meth:`__get__`, :" "meth:`__set__`, et :meth:`__delete__`. Si l'une de ces méthodes est définie " "pour un objet, il s'agit d'un descripteur." #: ../Doc/howto/descriptor.rst:32 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " "chain starting with ``a.__dict__['x']``, then ``type(a).__dict__['x']``, and " "continuing through the base classes of ``type(a)`` excluding metaclasses. If " "the looked-up value is an object defining one of the descriptor methods, " "then Python may override the default behavior and invoke the descriptor " "method instead. Where this occurs in the precedence chain depends on which " "descriptor methods were defined. Note that descriptors are only invoked for " "new style objects or classes (a class is new style if it inherits from :" "class:`object` or :class:`type`)." msgstr "" #: ../Doc/howto/descriptor.rst:43 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " "mechanism behind properties, methods, static methods, class methods, and :" "func:`super()`. They are used throughout Python itself to implement the new " "style classes introduced in version 2.2. Descriptors simplify the " "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:51 msgid "Descriptor Protocol" msgstr "Protocole descripteur" #: ../Doc/howto/descriptor.rst:53 msgid "``descr.__get__(self, obj, type=None) --> value``" msgstr "" #: ../Doc/howto/descriptor.rst:55 msgid "``descr.__set__(self, obj, value) --> None``" msgstr "" #: ../Doc/howto/descriptor.rst:57 msgid "``descr.__delete__(self, obj) --> None``" msgstr "" #: ../Doc/howto/descriptor.rst:59 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:63 msgid "" "If an object defines both :meth:`__get__` and :meth:`__set__`, it is " "considered a data descriptor. Descriptors that only define :meth:`__get__` " "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:68 msgid "" "Data and non-data descriptors differ in how overrides are calculated with " "respect to entries in an instance's dictionary. If an instance's dictionary " "has an entry with the same name as a data descriptor, the data descriptor " "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:74 msgid "" "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." msgstr "" "Pour faire un descripteur de données en lecture seule, définissez à la fois :" "meth:`__get__` et :meth:`__set__` avec :meth:`__set__` levant une erreur :" "exc:`AttributeError` quand il est appelé. Définir la méthode :meth:" "`__set__set__` avec une exception élevant le caractère générique est " "suffisant pour en faire un descripteur de données." #: ../Doc/howto/descriptor.rst:81 msgid "Invoking Descriptors" msgstr "Invocation des descripteurs" #: ../Doc/howto/descriptor.rst:83 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:86 msgid "" "Alternatively, it is more common for a descriptor to be invoked " "automatically upon attribute access. For example, ``obj.d`` looks up ``d`` " "in the dictionary of ``obj``. If ``d`` defines the method :meth:`__get__`, " "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__`, alors ``d.__get__(obj)`` est invoqué selon les " "règles de priorité énumérées ci-dessous." #: ../Doc/howto/descriptor.rst:91 msgid "" "The details of invocation depend on whether ``obj`` is an object or a class. " "Either way, descriptors only work for new style objects and classes. A " "class is new style if it is a subclass of :class:`object`." msgstr "" #: ../Doc/howto/descriptor.rst:95 msgid "" "For objects, the machinery is in :meth:`object.__getattribute__` which " "transforms ``b.x`` into ``type(b).__dict__['x'].__get__(b, type(b))``. The " "implementation works through a precedence chain that gives data descriptors " "priority over instance variables, instance variables priority over non-data " "descriptors, and assigns lowest priority to :meth:`__getattr__` if provided. " "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:103 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 machinerie est dans :meth:`type.__getattribute__` qui " "transforme ``B.x`` en ``B.__dict__['x'].__get__(None, B)``. En Python pur, " "il ressemble à : ::" #: ../Doc/howto/descriptor.rst:114 msgid "The important points to remember are:" msgstr "Les points importants à retenir sont :" #: ../Doc/howto/descriptor.rst:116 msgid "descriptors are invoked by the :meth:`__getattribute__` method" msgstr "les descripteurs sont appelés par la méthode :meth:`__getattribute__`" #: ../Doc/howto/descriptor.rst:117 msgid "overriding :meth:`__getattribute__` prevents automatic descriptor calls" msgstr "" "redéfinition :meth:`__getattribute____` empêche les appels automatiques de " "descripteurs" #: ../Doc/howto/descriptor.rst:118 msgid "" ":meth:`__getattribute__` is only available with new style classes and objects" msgstr "" #: ../Doc/howto/descriptor.rst:119 msgid "" ":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make " "different calls to :meth:`__get__`." msgstr "" ":meth:`objet.__getattribute__` et :meth:`type.__getattribute__` font " "différents appels à :meth:`__get__`." #: ../Doc/howto/descriptor.rst:121 msgid "data descriptors always override instance dictionaries." msgstr "" "les descripteurs de données remplacent toujours les dictionnaires " "d'instances." #: ../Doc/howto/descriptor.rst:122 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:124 msgid "" "The object returned by ``super()`` also has a custom :meth:" "`__getattribute__` method for invoking descriptors. The call ``super(B, " "obj).m()`` searches ``obj.__class__.__mro__`` for the base class ``A`` " "immediately following ``B`` and then returns ``A.__dict__['m'].__get__(obj, " "B)``. If not a descriptor, ``m`` is returned unchanged. If not in the " "dictionary, ``m`` reverts to a search using :meth:`object.__getattribute__`." msgstr "" "L'objet retourné par ``super()`` a aussi une méthode personnalisée :meth:" "`__getattribute__` pour appeler les descripteurs. L'appel ``super(B, obj)." "m()`` recherche ``obj.__class__.__mro__`` pour la classe de base ``A`` " "immédiatement après ``B`` et renvoie ensuite ``A.__dict__['m'].__get__(obj, " "B)``. Si ce n'est pas un descripteur, ``m`` est retourné inchangé. Si ce " "n'est pas dans le dictionnaire, ``m`` renvoie à une recherche avec :meth:" "`object.__getattribute__`." #: ../Doc/howto/descriptor.rst:131 msgid "" "Note, in Python 2.2, ``super(B, obj).m()`` would only invoke :meth:`__get__` " "if ``m`` was a data descriptor. In Python 2.3, non-data descriptors also " "get invoked unless an old-style class is involved. The implementation " "details are in :c:func:`super_getattro()` in :source:`Objects/typeobject.c`." msgstr "" #: ../Doc/howto/descriptor.rst:138 msgid "" "The details above show that the mechanism for descriptors is embedded in " "the :meth:`__getattribute__()` methods for :class:`object`, :class:`type`, " "and :func:`super`. Classes inherit this machinery when they derive from :" "class:`object` or if they have a meta-class providing similar functionality. " "Likewise, classes can turn-off descriptor invocation by overriding :meth:" "`__getattribute__()`." msgstr "" "Les détails ci-dessus montrent que le mécanisme des descripteurs est intégré " "dans les méthodes :meth:`__getattribute__()` pour :class:`object`, :class:" "`type` et :func:`super`. Les classes héritent de cette machinerie " "lorsqu'elles dérivent de :class:`object` ou si elles ont une méta-classe " "fournissant des fonctionnalités similaires. De même, les classes peuvent " "désactiver l'appel de descripteurs en remplaçant :meth:`__getattribute__()`." #: ../Doc/howto/descriptor.rst:147 msgid "Descriptor Example" msgstr "Exemple de descripteur" #: ../Doc/howto/descriptor.rst:149 msgid "" "The following code creates a class whose objects are data descriptors which " "print a message for each get or set. Overriding :meth:`__getattribute__` is " "alternate approach that could do this for every attribute. However, this " "descriptor is useful for monitoring just a few chosen attributes::" msgstr "" "Le code suivant crée une classe dont les objets sont des descripteurs de " "données qui impriment un message pour chaque lecture ou écriture. " "Redefinir :meth:`__getattribute__` est une approche alternative qui pourrait " "le faire pour chaque attribut. Cependant, ce descripteur n'est utile que " "pour le suivi de quelques attributs choisis : ::" #: ../Doc/howto/descriptor.rst:187 msgid "" "The protocol is simple and offers exciting possibilities. Several use cases " "are so common that they have been packaged into individual function calls. " "Properties, bound and unbound methods, static methods, and class methods are " "all based on the descriptor protocol." msgstr "" #: ../Doc/howto/descriptor.rst:194 msgid "Properties" msgstr "Propriétés" #: ../Doc/howto/descriptor.rst:196 msgid "" "Calling :func:`property` is a succinct way of building a data descriptor " "that triggers function calls upon access to an attribute. Its signature is::" msgstr "" "Appeler :func:`property` est une façon succincte de construire un " "descripteur de données qui déclenche des appels de fonction lors de l'accès " "à un attribut. Sa signature est : ::" #: ../Doc/howto/descriptor.rst:201 msgid "" "The documentation shows a typical use to define a managed attribute ``x``::" msgstr "" "La documentation montre une utilisation typique pour définir un attribut " "géré ``x`` : ::" #: ../Doc/howto/descriptor.rst:209 msgid "" "To see how :func:`property` is implemented in terms of the descriptor " "protocol, here is a pure Python equivalent::" msgstr "" "Pour voir comment :func:`property` est implémenté dans le protocole du " "descripteur, voici un un équivalent Python pur : ::" #: ../Doc/howto/descriptor.rst:249 msgid "" "The :func:`property` builtin helps whenever a user interface has granted " "attribute access and then subsequent changes require the intervention of a " "method." msgstr "" "La fonction :func:`property` intégrée aide chaque fois qu'une interface " "utilisateur a accordé l'accès à un attribut et que des modifications " "ultérieures nécessitent l'intervention d'une méthode." #: ../Doc/howto/descriptor.rst:253 msgid "" "For instance, a spreadsheet class may grant access to a cell value through " "``Cell('b10').value``. Subsequent improvements to the program require the " "cell to be recalculated on every access; however, the programmer does not " "want to affect existing client code accessing the attribute directly. The " "solution is to wrap access to the value attribute in a property data " "descriptor::" msgstr "" "Par exemple, une classe de tableur peut donner accès à une valeur de cellule " "via ``Cell('b10').value``. Les améliorations ultérieures du programme " "exigent que la cellule soit recalculée à chaque accès ; cependant, le " "programmeur ne veut pas affecter le code client existant accédant " "directement à l'attribut. La solution consiste à envelopper l'accès à " "l'attribut de valeur dans un descripteur de données de propriété : ::" #: ../Doc/howto/descriptor.rst:269 msgid "Functions and Methods" msgstr "Fonctions et méthodes" #: ../Doc/howto/descriptor.rst:271 msgid "" "Python's object oriented features are built upon a function based " "environment. Using non-data descriptors, the two are merged seamlessly." msgstr "" "Les fonctionnalités orientées objet de Python sont construites sur un " "environnement basé sur des fonctions. À l'aide de descripteurs *non-data*, " "les deux sont fusionnés de façon transparente." #: ../Doc/howto/descriptor.rst:274 msgid "" "Class dictionaries store methods as functions. In a class definition, " "methods are written using :keyword:`def` and :keyword:`lambda`, the usual " "tools for creating functions. The only difference from regular functions is " "that the first argument is reserved for the object instance. By Python " "convention, the instance reference is called *self* but may be called *this* " "or any other variable name." msgstr "" #: ../Doc/howto/descriptor.rst:281 msgid "" "To support method calls, functions include the :meth:`__get__` method for " "binding methods during attribute access. This means that all functions are " "non-data descriptors which return bound or unbound methods depending whether " "they are invoked from an object or a class. In pure python, it works like " "this::" msgstr "" #: ../Doc/howto/descriptor.rst:293 msgid "" "Running the interpreter shows how the function descriptor works in practice::" msgstr "" "L'exécution de l'interpréteur montre comment le descripteur de fonction se " "comporte dans la pratique : ::" #: ../Doc/howto/descriptor.rst:307 msgid "" "The output suggests that bound and unbound methods are two different types. " "While they could have been implemented that way, the actual C implementation " "of :c:type:`PyMethod_Type` in :source:`Objects/classobject.c` is a single " "object with two different representations depending on whether the :attr:" "`im_self` field is set or is *NULL* (the C equivalent of ``None``)." msgstr "" #: ../Doc/howto/descriptor.rst:313 msgid "" "Likewise, the effects of calling a method object depend on the :attr:" "`im_self` field. If set (meaning bound), the original function (stored in " "the :attr:`im_func` field) is called as expected with the first argument set " "to the instance. If unbound, all of the arguments are passed unchanged to " "the original function. The actual C implementation of :func:" "`instancemethod_call()` is only slightly more complex in that it includes " "some type checking." msgstr "" #: ../Doc/howto/descriptor.rst:322 msgid "Static Methods and Class Methods" msgstr "Méthodes statiques et méthodes de classe" #: ../Doc/howto/descriptor.rst:324 msgid "" "Non-data descriptors provide a simple mechanism for variations on the usual " "patterns of binding functions into methods." msgstr "" "Les descripteurs *non-data* fournissent un mécanisme simple pour les " "variations des patrons habituels des fonctions de liaison dans les méthodes." #: ../Doc/howto/descriptor.rst:327 msgid "" "To recap, functions have a :meth:`__get__` method so that they can be " "converted to a method when accessed as attributes. The non-data descriptor " "transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. Calling ``klass." "f(*args)`` becomes ``f(*args)``." msgstr "" "Pour résumer, les fonctions ont une méthode :meth:`__get__` pour qu'elles " "puissent être converties en méthode lorsqu'on y accède comme attributs. Le " "descripteur *non-data* transforme un appel ``obj.f(*args)``en ``f(obj, " "*args)``. Appeler ``klass.f(*args)`` devient ``f(*args)``." #: ../Doc/howto/descriptor.rst:332 msgid "This chart summarizes the binding and its two most useful variants:" msgstr "" "Ce tableau résume le lien (*binding*) et ses deux variantes les plus " "utiles : ::" #: ../Doc/howto/descriptor.rst:335 msgid "Transformation" msgstr "Transformation" #: ../Doc/howto/descriptor.rst:335 msgid "Called from an Object" msgstr "Appelé depuis un Objet" #: ../Doc/howto/descriptor.rst:335 msgid "Called from a Class" msgstr "Appelé depuis un Classe" #: ../Doc/howto/descriptor.rst:338 msgid "function" msgstr "fonction" #: ../Doc/howto/descriptor.rst:338 msgid "f(obj, \\*args)" msgstr "f(obj, \\*args)" #: ../Doc/howto/descriptor.rst:338 ../Doc/howto/descriptor.rst:340 msgid "f(\\*args)" msgstr "f(\\*args)" #: ../Doc/howto/descriptor.rst:340 msgid "staticmethod" msgstr "méthode statique" #: ../Doc/howto/descriptor.rst:342 msgid "classmethod" msgstr "méthode de classe" #: ../Doc/howto/descriptor.rst:342 msgid "f(type(obj), \\*args)" msgstr "f(type(obj), \\*args)" #: ../Doc/howto/descriptor.rst:342 msgid "f(klass, \\*args)" msgstr "f(klass, \\*args)" #: ../Doc/howto/descriptor.rst:345 msgid "" "Static methods return the underlying function without changes. Calling " "either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." "__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a " "result, the function becomes identically accessible from either an object or " "a class." msgstr "" "Les méthodes statiques renvoient la fonction sous-jacente sans " "modifications. Appeler ``c.f`` ou ``C.f`` est l'équivalent d'une recherche " "directe dans ``objet.__getattribute__(c, \"f\")`` ou ``objet." "__getattribute__(C, \"f\")``. Par conséquent, la fonction devient accessible " "de manière identique à partir d'un objet ou d'une classe." #: ../Doc/howto/descriptor.rst:351 msgid "" "Good candidates for static methods are methods that do not reference the " "``self`` variable." msgstr "" "Les bonnes candidates pour être méthode statique sont des méthodes qui ne " "font pas référence à la variable ``self``." #: ../Doc/howto/descriptor.rst:354 msgid "" "For instance, a statistics package may include a container class for " "experimental data. The class provides normal methods for computing the " "average, mean, median, and other descriptive statistics that depend on the " "data. However, there may be useful functions which are conceptually related " "but do not depend on the data. For instance, ``erf(x)`` is handy conversion " "routine that comes up in statistical work but does not directly depend on a " "particular dataset. It can be called either from an object or the class: " "``s.erf(1.5) --> .9332`` or ``Sample.erf(1.5) --> .9332``." msgstr "" "Par exemple, un paquet traitant de statistiques peut inclure une classe qui " "est un conteneur pour des données expérimentales. La classe fournit les " "méthodes normales pour calculer la moyenne, la moyenne, la médiane et " "d'autres statistiques descriptives qui dépendent des données. Cependant, il " "peut y avoir des fonctions utiles qui sont conceptuellement liées mais qui " "ne dépendent pas des données. Par exemple, ``erf(x)`` est une routine de " "conversion pratique qui apparaît dans le travail statistique mais qui ne " "dépend pas directement d'un ensemble de données particulier. Elle peut être " "appelée à partir d'un objet ou de la classe : ``s.erf(1.5) --> .9332``` ou " "``Sample.erf(1.5) --> .9332``." #: ../Doc/howto/descriptor.rst:363 msgid "" "Since staticmethods return the underlying function with no changes, the " "example calls are unexciting::" msgstr "" "Depuis que les méthodes statiques renvoient la fonction sous-jacente sans " "changement, les exemples d’appels ne sont pas excitants : ::" #: ../Doc/howto/descriptor.rst:376 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`staticmethod` would look like this::" msgstr "" "En utilisant le protocole de descripteur *non-data*, une version Python pure " "de :func:`staticmethod` ressemblerait à ceci : ::" #: ../Doc/howto/descriptor.rst:388 msgid "" "Unlike static methods, class methods prepend the class reference to the " "argument list before calling the function. This format is the same for " "whether the caller is an object or a class::" msgstr "" "Contrairement aux méthodes statiques, les méthodes de classe préchargent la " "référence de classe dans la liste d'arguments avant d'appeler la fonction. " "Ce format est le même que l'appelant soit un objet ou une classe : ::" #: ../Doc/howto/descriptor.rst:403 msgid "" "This behavior is useful whenever the function only needs to have a class " "reference and does not care about any underlying data. One use for " "classmethods is to create alternate class constructors. In Python 2.3, the " "classmethod :func:`dict.fromkeys` creates a new dictionary from a list of " "keys. The pure Python equivalent is::" msgstr "" "Ce comportement est utile lorsque la fonction n'a besoin que d'une référence " "de classe et ne se soucie pas des données sous-jacentes. Une des " "utilisations des méthodes de classe est de créer d'autres constructeurs de " "classe. En Python 2.3, la méthode de classe :func:`dict.fromkeys` crée un " "nouveau dictionnaire à partir d'une liste de clés. L'équivalent Python pur " "est : ::" #: ../Doc/howto/descriptor.rst:419 msgid "Now a new dictionary of unique keys can be constructed like this::" msgstr "" "Maintenant un nouveau dictionnaire de clés uniques peut être construit comme " "ceci : ::" #: ../Doc/howto/descriptor.rst:424 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`classmethod` would look like this::" msgstr "" "En utilisant le protocole de descripteur *non-data*, une version Python pure " "de :func:`classmethod` ressemblerait à ceci : ::"