# Copyright (C) 2001-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 3.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-04-02 22:11+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../Doc/library/numbers.rst:2 msgid ":mod:`numbers` --- Numeric abstract base classes" msgstr "" #: ../Doc/library/numbers.rst:7 msgid "**Source code:** :source:`Lib/numbers.py`" msgstr "" #: ../Doc/library/numbers.rst:11 msgid "" "The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric :term:" "`abstract base classes ` which progressively define " "more operations. None of the types defined in this module can be " "instantiated." msgstr "" #: ../Doc/library/numbers.rst:18 msgid "" "The root of the numeric hierarchy. If you just want to check if an argument " "*x* is a number, without caring what kind, use ``isinstance(x, Number)``." msgstr "" #: ../Doc/library/numbers.rst:23 msgid "The numeric tower" msgstr "" #: ../Doc/library/numbers.rst:27 msgid "" "Subclasses of this type describe complex numbers and include the operations " "that work on the built-in :class:`complex` type. These are: conversions to :" "class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, ``-" "``, ``*``, ``/``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!=``. All " "except ``-`` and ``!=`` are abstract." msgstr "" #: ../Doc/library/numbers.rst:35 msgid "Abstract. Retrieves the real component of this number." msgstr "" #: ../Doc/library/numbers.rst:39 msgid "Abstract. Retrieves the imaginary component of this number." msgstr "" #: ../Doc/library/numbers.rst:43 msgid "" "Abstract. Returns the complex conjugate. For example, ``(1+3j).conjugate() " "== (1-3j)``." msgstr "" #: ../Doc/library/numbers.rst:48 msgid "" "To :class:`Complex`, :class:`Real` adds the operations that work on real " "numbers." msgstr "" #: ../Doc/library/numbers.rst:51 msgid "" "In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" "func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " "``%``, ``<``, ``<=``, ``>``, and ``>=``." msgstr "" #: ../Doc/library/numbers.rst:55 msgid "" "Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" "attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." msgstr "" #: ../Doc/library/numbers.rst:61 msgid "" "Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" "`~Rational.denominator` properties, which should be in lowest terms. With " "these, it provides a default for :func:`float`." msgstr "" #: ../Doc/library/numbers.rst:68 ../Doc/library/numbers.rst:72 msgid "Abstract." msgstr "Résumé." #: ../Doc/library/numbers.rst:77 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " "defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" "`~Rational.denominator`. Adds abstract methods for ``**`` and bit-string " "operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``." msgstr "" #: ../Doc/library/numbers.rst:84 msgid "Notes for type implementors" msgstr "" #: ../Doc/library/numbers.rst:86 msgid "" "Implementors should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " "the real numbers. For example, :class:`fractions.Fraction` implements :func:" "`hash` as follows::" msgstr "" #: ../Doc/library/numbers.rst:105 msgid "Adding More Numeric ABCs" msgstr "" #: ../Doc/library/numbers.rst:107 msgid "" "There are, of course, more possible ABCs for numbers, and this would be a " "poor hierarchy if it precluded the possibility of adding those. You can add " "``MyFoo`` between :class:`Complex` and :class:`Real` with::" msgstr "" #: ../Doc/library/numbers.rst:119 msgid "Implementing the arithmetic operations" msgstr "" #: ../Doc/library/numbers.rst:121 msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " "arguments, or convert both to the nearest built in type and do the operation " "there. For subtypes of :class:`Integral`, this means that :meth:`__add__` " "and :meth:`__radd__` should be defined as::" msgstr "" #: ../Doc/library/numbers.rst:152 msgid "" "There are 5 different cases for a mixed-type operation on subclasses of :" "class:`Complex`. I'll refer to all of the above code that doesn't refer to " "``MyIntegral`` and ``OtherTypeIKnowAbout`` as \"boilerplate\". ``a`` will be " "an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: " "Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:" msgstr "" #: ../Doc/library/numbers.rst:159 msgid "If ``A`` defines an :meth:`__add__` which accepts ``b``, all is well." msgstr "" #: ../Doc/library/numbers.rst:161 msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`__add__`, we'd miss the possibility that ``B`` defines a more " "intelligent :meth:`__radd__`, so the boilerplate should return :const:" "`NotImplemented` from :meth:`__add__`. (Or ``A`` may not implement :meth:" "`__add__` at all.)" msgstr "" #: ../Doc/library/numbers.rst:167 msgid "" "Then ``B``'s :meth:`__radd__` gets a chance. If it accepts ``a``, all is " "well." msgstr "" #: ../Doc/library/numbers.rst:169 msgid "" "If it falls back to the boilerplate, there are no more possible methods to " "try, so this is where the default implementation should live." msgstr "" #: ../Doc/library/numbers.rst:172 msgid "" "If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, " "because it was implemented with knowledge of ``A``, so it can handle those " "instances before delegating to :class:`Complex`." msgstr "" #: ../Doc/library/numbers.rst:177 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " "then the appropriate shared operation is the one involving the built in :" "class:`complex`, and both :meth:`__radd__` s land there, so ``a+b == b+a``." msgstr "" #: ../Doc/library/numbers.rst:182 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " "reverse instances of any given operator. For example, :class:`fractions." "Fraction` uses::" msgstr ""