Skip to content

Traducción reference/datamodel #1188

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

Merged
merged 24 commits into from
Mar 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avance a 55%
  • Loading branch information
migrmrz committed Dec 23, 2020
commit 394fdb80aa7c63a1798e2bba33d56276ae2b8c31
100 changes: 95 additions & 5 deletions reference/datamodel.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ msgstr ""
"Project-Id-Version: Python 3.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-05 12:54+0200\n"
"PO-Revision-Date: 2020-12-22 19:53-0600\n"
"PO-Revision-Date: 2020-12-23 13:32-0600\n"
"Language-Team: python-doc-es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -2455,6 +2455,11 @@ msgid ""
"``x.__hash__()`` returns an appropriate value such that ``x == y`` implies "
"both that ``x is y`` and ``hash(x) == hash(y)``."
msgstr ""
"Clases definidas por usuario tienen los métodos :meth:`__eq__` y :meth:"
"`__hash__` por defecto; con ellos, todos los objetos se comparan de manera "
"desigual (excepto con ellos mismos) y ``x.__hash__()`` devuelve un valor "
"apropiado tal que ``x == y`` implique que ``x es y`` y ``hash(x) == "
"hash(y)``."

#: ../Doc/reference/datamodel.rst:1438
msgid ""
Expand All @@ -2465,13 +2470,22 @@ msgid ""
"hash value, and will also be correctly identified as unhashable when "
"checking ``isinstance(obj, collections.abc.Hashable)``."
msgstr ""
"Una clase que anula :meth:`__eq__` y no define :meth:`__hash__` tendrá "
"implícito su :meth:`__hash__` establecido a ``None``. Cuando el método :meth:"
"`__hash__` de una clase es ``None``, instancias de la clase lanzarán un :exc:"
"`TypeError` cuando el programa intente obtener el valor del hash, y también "
"será correctamente identificado como de hash no calculable cuando se "
"verifique ``isinstance(obj, collections.abc.Hashable)``."

#: ../Doc/reference/datamodel.rst:1445
msgid ""
"If a class that overrides :meth:`__eq__` needs to retain the implementation "
"of :meth:`__hash__` from a parent class, the interpreter must be told this "
"explicitly by setting ``__hash__ = <ParentClass>.__hash__``."
msgstr ""
"Si una clase que anula :meth:`__eq__` necesita conservar la implementación "
"de :meth:`__hash__` de una clase padre, al intérprete se le debe informar "
"explícitamente estableciendo ``__hash__ = <ParentClass>.__hash__``."

#: ../Doc/reference/datamodel.rst:1449
msgid ""
Expand All @@ -2481,6 +2495,11 @@ msgid ""
"`TypeError` would be incorrectly identified as hashable by an "
"``isinstance(obj, collections.abc.Hashable)`` call."
msgstr ""
"Si una clase que no anula :meth:`__eq__` desea eliminar el soporte de "
"*hash*, debe incluir ``__hash__ = None`` en la definición de clase. Una "
"clase que define su propio :meth:`__hash__` y que explícitamente lanza un :"
"exc:`TypeError` será identificado de manera incorrecta como de hash "
"calculable por una llamada ``isinstance(obj, collections.abc.Hashable)``."

#: ../Doc/reference/datamodel.rst:1458
msgid ""
Expand All @@ -2489,6 +2508,10 @@ msgid ""
"an individual Python process, they are not predictable between repeated "
"invocations of Python."
msgstr ""
"Por defecto los valores de objetos str y bytes de :meth:`__hash__` son "
"“salados” con un valor aleatorio impredecible. Aunque se mantienen "
"constantes dentro de un proceso Python particular, no son predecibles entre "
"invocaciones repetidas de Python."

#: ../Doc/reference/datamodel.rst:1463
msgid ""
Expand All @@ -2497,21 +2520,28 @@ msgid ""
"insertion, O(n^2) complexity. See http://www.ocert.org/advisories/"
"ocert-2011-003.html for details."
msgstr ""
"Esto tiene la intención de proveer protección contra una negación de "
"servicio causada por entradas cautelosamente elegidas y que explotan el peor "
"caso de rendimiento en la inserción de un diccionario, complejidad O(n^2). "
"Ver http://www.ocert.org/advisories/ocert-2011-003.html para más detalles."

#: ../Doc/reference/datamodel.rst:1468
msgid ""
"Changing hash values affects the iteration order of sets. Python has never "
"made guarantees about this ordering (and it typically varies between 32-bit "
"and 64-bit builds)."
msgstr ""
"Cambiar los valores hash afectan el orden de la iteración de los sets. "
"Python nunca ha dado garantías en relación a este orden (y típicamente varía "
"entre estructuras de 32-bits y 64-bits)."

#: ../Doc/reference/datamodel.rst:1472
msgid "See also :envvar:`PYTHONHASHSEED`."
msgstr ""
msgstr "Ver también :envvar:`PYTHONHASHSEED`."

#: ../Doc/reference/datamodel.rst:1474
msgid "Hash randomization is enabled by default."
msgstr ""
msgstr "La aleatorización de hash es habilitada por defecto."

#: ../Doc/reference/datamodel.rst:1482
msgid ""
Expand All @@ -2521,17 +2551,26 @@ msgid ""
"considered true if its result is nonzero. If a class defines neither :meth:"
"`__len__` nor :meth:`__bool__`, all its instances are considered true."
msgstr ""
"Es llamado para implementar pruebas de valores de verdad y la operación "
"incorporada ``bool()``; debe retornar ``False`` o ``True``. Cuando este "
"método no es definido, :meth:`__len__` es llamado, si es definido, y el "
"objeto es considerado verdadero (*true*) si el resultado es diferente de "
"zero. Si la clase no define :meth:`__len__` ni :meth:`__bool__`, todas sus "
"instancias son consideradas verdaderas (*true*)."

#: ../Doc/reference/datamodel.rst:1493
msgid "Customizing attribute access"
msgstr ""
msgstr "Personalizando acceso a atributos"

#: ../Doc/reference/datamodel.rst:1495
msgid ""
"The following methods can be defined to customize the meaning of attribute "
"access (use of, assignment to, or deletion of ``x.name``) for class "
"instances."
msgstr ""
"Los siguientes métodos pueden ser definidos para personalizar el significado "
"de acceso a atributos (uso de, asignación a, o borrado de ``x.name``) para "
"instancias de clase."

#: ../Doc/reference/datamodel.rst:1503
msgid ""
Expand All @@ -2542,6 +2581,13 @@ msgid ""
"`AttributeError`). This method should either return the (computed) "
"attribute value or raise an :exc:`AttributeError` exception."
msgstr ""
"Es llamado cuando el acceso a atributos por defecto falla con un :exc:"
"`AttributeError` (ya sea que :meth:`__getattribute__` lanza una excepción :"
"exc:`AttributeError` porque *name* no es un atributo de instancia o un "
"atributo en el árbol de clase para ``self``; o el :meth:`__get__` de la "
"propiedad de *name* lanza una excepción :exc:`AttributeError`). Este método "
"debe retornar el valor de atributo (calculado) o lanzar una excepción :exc:"
"`AttributeError`."

#: ../Doc/reference/datamodel.rst:1510
msgid ""
Expand All @@ -2555,6 +2601,16 @@ msgid ""
"object). See the :meth:`__getattribute__` method below for a way to "
"actually get total control over attribute access."
msgstr ""
"Tome en cuenta que si el atributo es encontrado a través del mecanismo "
"normal, :meth:`__getattr__` no es llamado. (Esto es una asimetría "
"intencional entre :meth:`__getattr__` y :meth:`__setattr__`.) Esto es "
"realizado tanto por motivos de eficiencia y porque de otra manera :meth:"
"`__getattr__` no tendría manera de acceder a otros atributos de la "
"instancia. Tome en cuenta que al menos para variables de instancia, se puede "
"fingir control total al no insertar ningún valor en el diccionario de "
"atributo de instancia (sino insertándolos en otro objeto). Ver el método :"
"meth:`__getattribute__` a continuación para una forma de tener control total "
"sobre el acceso de atributo."

#: ../Doc/reference/datamodel.rst:1523
msgid ""
Expand All @@ -2567,44 +2623,69 @@ msgid ""
"base class method with the same name to access any attributes it needs, for "
"example, ``object.__getattribute__(self, name)``."
msgstr ""
"Es llamado incondicionalmente para implementar acceso de atributo por "
"instancias de clase. Si la clase también define :meth:`__getattr__`, éste no "
"será llamado a menos que :meth:`__getattribute__` lo llame de manera "
"explícita o lance una excepción :exc:`AttributeError`. Este método deberá "
"retornar el valor de atributo (calculado) o lanzar una excepción :exc:"
"`AttributeError`. Para evitar la recursividad infinita en este método, su "
"implementación deberá siempre llamar al método de la clase base con el mismo "
"nombre para acceder cualquier atributo que necesite, por ejemplo, ``object."
"__getattribute__(self, name)``."

#: ../Doc/reference/datamodel.rst:1534
msgid ""
"This method may still be bypassed when looking up special methods as the "
"result of implicit invocation via language syntax or built-in functions. "
"See :ref:`special-lookup`."
msgstr ""
"Este método aún puede ser sobrepasado cuando se buscan métodos especiales "
"como resultado de una invocación implícita a través de sintaxis de lenguaje "
"o funciones implícitas. Ver :ref:`special-lookup`."

#: ../Doc/reference/datamodel.rst:1541
msgid ""
"Called when an attribute assignment is attempted. This is called instead of "
"the normal mechanism (i.e. store the value in the instance dictionary). "
"*name* is the attribute name, *value* is the value to be assigned to it."
msgstr ""
"Es llamado cuando se intenta la asignación de atributos. Éste es llamado en "
"lugar del mecanismo normal (p. ej. guardar el valor en el diccionario de "
"instancias). *name* es el nombre de atributo, *value* es el valor que se le "
"asigna."

#: ../Doc/reference/datamodel.rst:1545
msgid ""
"If :meth:`__setattr__` wants to assign to an instance attribute, it should "
"call the base class method with the same name, for example, ``object."
"__setattr__(self, name, value)``."
msgstr ""
"Si :meth:`__setattr__` quiere asignar a un atributo de instancia, debe "
"llamar al método de la clase base con el mismo nombre, por ejemplo, ``object."
"__setattr__(self, name, value)``."

#: ../Doc/reference/datamodel.rst:1552
msgid ""
"Like :meth:`__setattr__` but for attribute deletion instead of assignment. "
"This should only be implemented if ``del obj.name`` is meaningful for the "
"object."
msgstr ""
"Al igual que :meth:`__setattr__` pero para borrado de atributos en lugar de "
"establecerlos. Esto solo de ser implementado si ``del obj.name`` es "
"significativo para el objeto."

#: ../Doc/reference/datamodel.rst:1558
msgid ""
"Called when :func:`dir` is called on the object. A sequence must be "
"returned. :func:`dir` converts the returned sequence to a list and sorts it."
msgstr ""
"Es llamado cuando :func:`dir` es llamado en el objeto. Una secuencia debe "
"ser retornada. :func:`dir` convierte la secuencia retornada a una lista y la "
"ordena."

#: ../Doc/reference/datamodel.rst:1563
msgid "Customizing module attribute access"
msgstr ""
msgstr "Personalizando acceso a atributos de módulo"

#: ../Doc/reference/datamodel.rst:1570
msgid ""
Expand All @@ -2617,6 +2698,15 @@ msgid ""
"``__dict__`` before raising an :exc:`AttributeError`. If found, it is called "
"with the attribute name and the result is returned."
msgstr ""
"Nombres especiales ``__getattr__`` y ``__dir__`` también pueden ser "
"utilizados para personalizar acceso a atributos de módulo. La función "
"``__getattr__`` a nivel del módulo debe aceptar un argumento que es el "
"nombre del atributo y retornar el valor calculado o lanzar una excepción :"
"exc:`AttributeError`. Si un atributo no es encontrado en el objeto de módulo "
"a través de una búsqueda normal, p. ej. :meth:`object.__getattribute__`, "
"entonces ``__getattr__`` es buscado en el módulo ``__dict__`` antes de "
"lanzar una excepción :exc:`AttributeError`. Si es encontrado, es llamado con "
"el nombre de atributo y el resultado es retornado."

#: ../Doc/reference/datamodel.rst:1579
msgid ""
Expand Down