[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/python/python-docs-es/format_diff_update/faq/programming.po [Back]  [Original]

# Copyright (C) 2001-2020, Python Software Foundation
# This file is distributed under the same license as the Python package.
# Maintained by the python-doc-es workteam.
# docs-es@python.org /
# https://mail.python.org/mailman3/lists/docs-es.python.org/
# Check https://github.com/python/python-docs-es/blob/3.8/TRANSLATORS to
# get the list of volunteers
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-12 19:43+0200\n"
"PO-Revision-Date: 2024-01-21 16:47+0100\n"
"Last-Translator: Juan C. Tello \n"
"Language-Team: python-doc-es\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: Babel 2.13.0\n"
"X-Generator: Poedit 3.0.1\n"

#: ../Doc/faq/programming.rst:5
msgid "Programming FAQ"
msgstr "Preguntas frecuentes de programacin"

#: ../Doc/faq/programming.rst:8
msgid "Contents"
msgstr "Contenido"

#: ../Doc/faq/programming.rst:12
msgid "General Questions"
msgstr "Preguntas generales"

#: ../Doc/faq/programming.rst:15
msgid ""
"Is there a source code level debugger with breakpoints, single-stepping, "
"etc.?"
msgstr ""
"Existe un depurador a nivel de cdigo fuente con puntos de interrupcin, "
"depuracin paso a paso, etc?"

#: ../Doc/faq/programming.rst:17 ../Doc/faq/programming.rst:58
msgid "Yes."
msgstr "S."

#: ../Doc/faq/programming.rst:19
msgid ""
"Several debuggers for Python are described below, and the built-in function :"
"func:`breakpoint` allows you to drop into any of them."
msgstr ""
"Debajo se describen algunos depuradores para Python y la funcin integrada :"
"func:`breakpoint` te permite ejecutar alguno de ellos."

#: ../Doc/faq/programming.rst:22
msgid ""
"The pdb module is a simple but adequate console-mode debugger for Python. It "
"is part of the standard Python library, and is :mod:`documented in the "
"Library Reference Manual `. You can also write your own debugger by "
"using the code for pdb as an example."
msgstr ""
"El mdulo pdb es en depurador en modo consola simple pero conveniente para "
"Python. Es parte de la biblioteca estndar de Python y est :mod:"
"`documentado en el manual de referencia de la biblioteca `. Puedes "
"escribir tu propio depurador usando el cdigo de pdb como ejemplo."

#: ../Doc/faq/programming.rst:27
#, fuzzy
msgid ""
"The IDLE interactive development environment, which is part of the standard "
"Python distribution (normally available as `Tools/scripts/idle3 `_), includes a "
"graphical debugger."
msgstr ""
"El entorno interactivo de desarrollo IDLE, el cual es parte de la "
"distribucin Python estndar (disponible, generalmente,  como Tools/scripts/"
"idle), incluye un depurador grfico."

#: ../Doc/faq/programming.rst:32
msgid ""
"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 "
"as debugging non-PythonWin programs.  PythonWin is available as part of "
"`pywin32 `_ project and as a part of "
"the `ActivePython `_ "
"distribution."
msgstr ""
"PythonWin es un IDE Python que incluye un depurador con GUI basado en pdb. "
"El depurador PythonWin colorea los puntos de interrupcin y dispone de "
"caractersticas geniales como la depuracin de programas no modificados "
"mediante PythonWin. PythonWin est disponible como parte del proyecto `Las "
"extensiones de Python para Windows `_ y como parte de la distribucin `ActivePython `_."

#: ../Doc/faq/programming.rst:39
#, fuzzy
msgid ""
"`Eric `_ is an IDE built on PyQt and "
"the Scintilla editing component."
msgstr ""
"`Eric `_ es un IDE creado usando PyQt "
"y el componente de edicin Scintilla."

#: ../Doc/faq/programming.rst:42
msgid ""
"`trepan3k `_ is a gdb-like "
"debugger."
msgstr ""
"`trepan3k `_ es un depurador "
"similar a `gdb`."

#: ../Doc/faq/programming.rst:44
msgid ""
"`Visual Studio Code `_ is an IDE with "
"debugging tools that integrates with version-control software."
msgstr ""
"`Visual Studio Code `_ es un IDE con "
"herramientas de depuracin que se integra con software de control de "
"versiones."

#: ../Doc/faq/programming.rst:47
msgid ""
"There are a number of commercial Python IDEs that include graphical "
"debuggers. They include:"
msgstr ""
"Existen varios IDEs comerciales para Python que incluyen depuradores "
"grficos. Entre ellos tenemos:"

#: ../Doc/faq/programming.rst:50
msgid "`Wing IDE `_"
msgstr "`IDE Wing `_"

#: ../Doc/faq/programming.rst:51
msgid "`Komodo IDE `_"
msgstr "`IDE Komodo `_"

#: ../Doc/faq/programming.rst:52
msgid "`PyCharm `_"
msgstr "`PyCharm `_"

#: ../Doc/faq/programming.rst:56
msgid "Are there tools to help find bugs or perform static analysis?"
msgstr ""
"Existe alguna herramienta que ayude a encontrar errores o realizar anlisis "
"esttico?"

#: ../Doc/faq/programming.rst:60
#, fuzzy
msgid ""
"`Pylint `_ and `Pyflakes "
"`_ do basic checking that will help you "
"catch bugs sooner."
msgstr ""
"`Pylint `_ y `Pyflakes `_ realizan comprobaciones bsicas que le ayudarn a detectar "
"errores antes."

#: ../Doc/faq/programming.rst:64
#, fuzzy
msgid ""
"Static type checkers such as `Mypy `_, `Pyre "
"`_, and `Pytype `_ can check type hints in Python source code."
msgstr ""
"Inspectores estticos de tipos como `Mypy `_, `Pyre "
"`_, y `Pytype `_ "
"pueden hacer comprobaciones de las anotaciones de tipos en cdigo fuente "
"Python."

#: ../Doc/faq/programming.rst:73
msgid "How can I create a stand-alone binary from a Python script?"
msgstr ""
"Cmo puedo crear un binario independiente a partir de un programa Python?"

#: ../Doc/faq/programming.rst:75
msgid ""
"You don't need the ability to compile Python to C code if all you want is a "
"stand-alone program that users can download and run without having to "
"install the Python distribution first.  There are a number of tools that "
"determine the set of modules required by a program and bind these modules "
"together with a Python binary to produce a single executable."
msgstr ""
"No necesitas tener la habilidad de compilar Python a cdigo C si lo nico "
"que necesitas es un programa independiente que los usuarios puedan descargar "
"y ejecutar sin necesidad de instalar primero una distribucin Python. Existe "
"una serie de herramientas que determinan el conjunto de mdulos que necesita "
"un programa y une estos mdulos conjuntamente con un binario Python para "
"generar un nico ejecutable."

#: ../Doc/faq/programming.rst:81
#, fuzzy
msgid ""
"One is to use the freeze tool, which is included in the Python source tree "
"as `Tools/freeze `_. It converts Python byte code to C arrays; with a C compiler you "
"can embed all your modules into a new program, which is then linked with the "
"standard Python modules."
msgstr ""
"Una forma es usando la herramienta *freeze*, la cual viene incluida con el "
"rbol de cdigo Python como ``Tools/freeze``. Convierte el byte code Python "
"a arrays C; un compilador C permite incrustar todos tus mdulos en un nuevo "
"programa que, posteriormente se puede enlazar con los mdulos estndar de "
"Python."

#: ../Doc/faq/programming.rst:87
msgid ""
"It works by scanning your source recursively for import statements (in both "
"forms) and looking for the modules in the standard Python path as well as in "
"the source directory (for built-in modules).  It then turns the bytecode for "
"modules written in Python into C code (array initializers that can be turned "
"into code objects using the marshal module) and creates a custom-made config "
"file that only contains those built-in modules which are actually used in "
"the program.  It then compiles the generated C code and links it with the "
"rest of the Python interpreter to form a self-contained binary which acts "
"exactly like your script."
msgstr ""
"Funciona escaneando su fuente de forma recursiva en busca de declaraciones "
"de importacin (en ambas formas) y buscando los mdulos en la ruta estndar "
"de Python, as como en el directorio de la fuente (para los mdulos "
"incorporados).  Luego convierte el *bytecode* de los mdulos escritos en "
"Python en cdigo C (inicializadores de arrays que pueden ser convertidos en "
"objetos de cdigo usando el mdulo marshal) y crea un archivo de "
"configuracin a medida que slo contiene aquellos mdulos incorporados que "
"se usan realmente en el programa.  A continuacin, compila el cdigo C "
"generado y lo enlaza con el resto del intrprete de Python para formar un "
"binario autnomo que acta exactamente igual que su script."

#: ../Doc/faq/programming.rst:96
msgid ""
"The following packages can help with the creation of console and GUI "
"executables:"
msgstr ""
"Los siguientes paquetes pueden ayudar con la creacin de ejecutables de "
"consola y GUI:"

#: ../Doc/faq/programming.rst:99
msgid "`Nuitka `_ (Cross-platform)"
msgstr "`Nuitka `_ (Multiplataforma)"

#: ../Doc/faq/programming.rst:100
#, fuzzy
msgid "`PyInstaller `_ (Cross-platform)"
msgstr "`PyInstaller `_ (Multiplataforma)"

#: ../Doc/faq/programming.rst:101
msgid ""
"`PyOxidizer `_ (Cross-platform)"
msgstr ""
"`PyOxidizer `_ "
"(Multiplataforma)"

#: ../Doc/faq/programming.rst:102
msgid ""
"`cx_Freeze `_ (Cross-platform)"
msgstr ""
"`cx_Freeze `_ (Multiplataforma)"

#: ../Doc/faq/programming.rst:103
msgid "`py2app `_ (macOS only)"
msgstr "`py2app `_ (macOS solamente)"

#: ../Doc/faq/programming.rst:104
#, fuzzy
msgid "`py2exe `_ (Windows only)"
msgstr "`py2exe `_ (solo Windows)"

#: ../Doc/faq/programming.rst:107
msgid "Are there coding standards or a style guide for Python programs?"
msgstr ""
"Existen estndares de cdigo o una gua de estilo para programas Python?"

#: ../Doc/faq/programming.rst:109
msgid ""
"Yes.  The coding style required for standard library modules is documented "
"as :pep:`8`."
msgstr ""
"S. El estilo de cdigo requerido para los mdulos de la biblioteca estndar "
"se encuentra documentado como :pep:`8`."

#: ../Doc/faq/programming.rst:114
msgid "Core Language"
msgstr "Ncleo del lenguaje"

#: ../Doc/faq/programming.rst:119
msgid "Why am I getting an UnboundLocalError when the variable has a value?"
msgstr ""
"Por qu obtengo un *UnboundLocalError* cuando la variable tiene un valor?"

#: ../Doc/faq/programming.rst:121
#, fuzzy
msgid ""
"It can be a surprise to get the :exc:`UnboundLocalError` in previously "
"working code when it is modified by adding an assignment statement somewhere "
"in the body of a function."
msgstr ""
"Puede ser una sorpresa el hecho de obtener un UnboundLocalError en cdigo "
"que haba estado funcionando previamente cuando se modifica mediante el "
"aadido de una declaracin de asignacin en alguna parte del cuerpo de una "
"funcin."

#: ../Doc/faq/programming.rst:125
msgid "This code:"
msgstr "Este cdigo:"

#: ../Doc/faq/programming.rst:134
msgid "works, but this code:"
msgstr "funciona, pero este cdigo:"

#: ../Doc/faq/programming.rst:141
#, fuzzy
msgid "results in an :exc:`!UnboundLocalError`:"
msgstr "resulta en un UnboundLocalError:"

#: ../Doc/faq/programming.rst:148
msgid ""
"This is because when you make an assignment to a variable in a scope, that "
"variable becomes local to that scope and shadows any similarly named "
"variable in the outer scope.  Since the last statement in foo assigns a new "
"value to ``x``, the compiler recognizes it as a local variable.  "
"Consequently when the earlier ``print(x)`` attempts to print the "
"uninitialized local variable and an error results."
msgstr ""
"Esto es debido a que cuando realizas una asignacin a una variable en un  "
"mbito de aplicacin, esa variable se convierte en local y enmascara "
"cualquier variable llamada de forma similar en un mbito de aplicacin "
"exterior. Desde la ltima declaracin en foo asigna un nuevo valor a ``x``, "
"el compilador la reconoce como una variable local. Consecuentemente, cuando "
"el ``print(x)`` ms prximo intenta mostrar la variable local no "
"inicializada se muestra un error."

#: ../Doc/faq/programming.rst:155
msgid ""
"In the example above you can access the outer scope variable by declaring it "
"global:"
msgstr ""
"En el ejemplo anterior puedes acceder al mbito de aplicacin exterior a la "
"variable declarndola como global:"

#: ../Doc/faq/programming.rst:167
msgid ""
"This explicit declaration is required in order to remind you that (unlike "
"the superficially analogous situation with class and instance variables) you "
"are actually modifying the value of the variable in the outer scope:"
msgstr ""
"Esta declaracin explcita es necesaria de cara a recordarte que (a "
"diferencia de la situacin superficialmente anloga con las variables de "
"clase e instancia) ests modificando el valor de la variable en un mbito de "
"aplicacin ms externo:"

#: ../Doc/faq/programming.rst:174
msgid ""
"You can do a similar thing in a nested scope using the :keyword:`nonlocal` "
"keyword:"
msgstr ""
"Puedes hacer algo similar en un mbito de aplicacin anidado usando la "
"palabra clave :keyword:`nonlocal`:"

#: ../Doc/faq/programming.rst:192
msgid "What are the rules for local and global variables in Python?"
msgstr ""
"Cules son las reglas para las variables locales y globales en Python?"

#: ../Doc/faq/programming.rst:194
msgid ""
"In Python, variables that are only referenced inside a function are "
"implicitly global.  If a variable is assigned a value anywhere within the "
"function's body, it's assumed to be a local unless explicitly declared as "
"global."
msgstr ""
"En Python, las variables que solo se encuentran referenciadas dentro de una "
"funcin son globales implcitamente.  Si a una variable se le asigna un "
"valor en cualquier lugar dentro del cuerpo de una funcin, se asumir que es "
"local a no ser que explcitamente se la declare como global."

#: ../Doc/faq/programming.rst:198
msgid ""
"Though a bit surprising at first, a moment's consideration explains this.  "
"On one hand, requiring :keyword:`global` for assigned variables provides a "
"bar against unintended side-effects.  On the other hand, if ``global`` was "
"required for all global references, you'd be using ``global`` all the time.  "
"You'd have to declare as global every reference to a built-in function or to "
"a component of an imported module.  This clutter would defeat the usefulness "
"of the ``global`` declaration for identifying side-effects."
msgstr ""
"Aunque, inicialmente, puede parecer sorprendente, un momento de "
"consideracin permite explicar esto.  Por una parte, requerir :keyword:"
"`global` para variables asignadas proporciona una barrera frente a efectos "
"secundarios indeseados.  Por otra parte, si ``global`` es requerido para "
"todas las referencias globales, debers usar ``global`` en todo momento. "
"Deberas declarar como global cualquier referencia a una funcin integrada o "
"a un componente de un mdulo importado. Este embrollo arruinara la utilidad "
"de la declaracin \"global\" para identificar los efectos secundarios."

#: ../Doc/faq/programming.rst:208
msgid ""
"Why do lambdas defined in a loop with different values all return the same "
"result?"
msgstr ""
"Por qu las funciones lambda definidas en un bucle con diferentes valores "
"devuelven todas el mismo resultado?"

#: ../Doc/faq/programming.rst:210
msgid ""
"Assume you use a for loop to define a few different lambdas (or even plain "
"functions), e.g.::"
msgstr ""
"Considera que usas un bucle *for* para crear unas pocas funciones lambda (o, "
"incluso, funciones normales), por ejemplo.::"

#: ../Doc/faq/programming.rst:217
msgid ""
"This gives you a list that contains 5 lambdas that calculate ``x**2``.  You "
"might expect that, when called, they would return, respectively, ``0``, "
"``1``, ``4``, ``9``, and ``16``.  However, when you actually try you will "
"see that they all return ``16``::"
msgstr ""
"Lo siguiente proporciona una lista que contiene 5 funciones lambda que "
"calculan ``x**2``. Esperaras que, cuando se les invoca, retornaran, "
"respectivamente, ``0``, ``1``, ``4``, ``9`` y ``16``. Sin embargo, cuando lo "
"ejecutes vers que todas devuelven ``16``::"

#: ../Doc/faq/programming.rst:227
msgid ""
"This happens because ``x`` is not local to the lambdas, but is defined in "
"the outer scope, and it is accessed when the lambda is called --- not when "
"it is defined.  At the end of the loop, the value of ``x`` is ``4``, so all "
"the functions now return ``4**2``, i.e. ``16``.  You can also verify this by "
"changing the value of ``x`` and see how the results of the lambdas change::"
msgstr ""
"Esto sucede porque ``x`` no es una funcin lambda local pero se encuentra "
"definida en un mbito de aplicacin externo y se accede cuando la lambda es "
"invocada --- no cuando ha sido definida.  Al final del bucle, el valor de "
"``x`` es ``4``, por tanto, ahora todas las funciones devuelven ``4**2``, i."
"e. ``16``. Tambin puedes verificar esto mediante el cambio del valor de "
"``x`` y ver como los resultados de las lambdas cambian::"

#: ../Doc/faq/programming.rst:237
msgid ""
"In order to avoid this, you need to save the values in variables local to "
"the lambdas, so that they don't rely on the value of the global ``x``::"
msgstr ""
"De cara a evitar esto necesitas guardar los valores en variables locales a "
"las funciones lambda de tal forma que no dependan del valor de la  ``x`` "
"global::"

#: ../Doc/faq/programming.rst:244
msgid ""
"Here, ``n=x`` creates a new variable ``n`` local to the lambda and computed "
"when the lambda is defined so that it has the same value that ``x`` had at "
"that point in the loop.  This means that the value of ``n`` will be ``0`` in "
"the first lambda, ``1`` in the second, ``2`` in the third, and so on. "
"Therefore each lambda will now return the correct result::"
msgstr ""
"Aqu, ``n=x`` crea una nueva variable ``n`` local a la funcin lambda y "
"ejecutada cuando la funcin lambda se define de tal forma que tiene el mismo "
"valor que tena ``x`` en ese punto en el bucle.  Esto significa que el valor "
"de ``n`` ser ``0`` en la primera funcin lambda, ``1`` en la segunda, ``2`` "
"en la tercera y as sucesivamente. Por tanto, ahora cada lambda retornar el "
"resultado correcto::"

#: ../Doc/faq/programming.rst:255
msgid ""
"Note that this behaviour is not peculiar to lambdas, but applies to regular "
"functions too."
msgstr ""
"Es de destacar que este comportamiento no es peculiar de las funciones "
"lambda sino que aplica tambin a las funciones regulares."

#: ../Doc/faq/programming.rst:260
msgid "How do I share global variables across modules?"
msgstr "Cmo puedo compartir variables globales entre mdulos?"

#: ../Doc/faq/programming.rst:262
msgid ""
"The canonical way to share information across modules within a single "
"program is to create a special module (often called config or cfg).  Just "
"import the config module in all modules of your application; the module then "
"becomes available as a global name.  Because there is only one instance of "
"each module, any changes made to the module object get reflected "
"everywhere.  For example:"
msgstr ""
"La forma cannica de compartir informacin entre mdulos dentro de un mismo "
"programa sera creando un mdulo especial (a menudo llamado config o cfg).  "
"Simplemente importa el mdulo config  en todos los mdulos de tu aplicacin; "
"el mdulo estar disponible como un nombre global.  Debido a que solo hay "
"una instancia de cada mdulo, cualquier cambio hecho en el objeto mdulo se "
"reflejar en todos los sitios.  Por ejemplo:"

#: ../Doc/faq/programming.rst:268
msgid "config.py::"
msgstr "config.py::"

#: ../Doc/faq/programming.rst:272
msgid "mod.py::"
msgstr "mod.py::"

#: ../Doc/faq/programming.rst:277
msgid "main.py::"
msgstr "main.py::"

#: ../Doc/faq/programming.rst:283
#, fuzzy
msgid ""
"Note that using a module is also the basis for implementing the singleton "
"design pattern, for the same reason."
msgstr ""
"Ten en cuenta que usar un mdulo es tambin la base para la implementacin "
"del patrn de diseo Singleton, por la misma razn."

#: ../Doc/faq/programming.rst:288
msgid "What are the \"best practices\" for using import in a module?"
msgstr "Cules son las \"buenas prcticas\" para usar import en un mdulo?"

#: ../Doc/faq/programming.rst:290
msgid ""
"In general, don't use ``from modulename import *``.  Doing so clutters the "
"importer's namespace, and makes it much harder for linters to detect "
"undefined names."
msgstr ""
"En general, no uses ``from modulename import *``.  Haciendo eso embarulla el "
"espacio de nombres del importador y hace que sea ms difcil para los "
"*linters* el detectar los nombres sin definir."

#: ../Doc/faq/programming.rst:294
msgid ""
"Import modules at the top of a file.  Doing so makes it clear what other "
"modules your code requires and avoids questions of whether the module name "
"is in scope. Using one import per line makes it easy to add and delete "
"module imports, but using multiple imports per line uses less screen space."
msgstr ""
"Importar los mdulos en la parte inicial del fichero. Hacindolo as  deja "
"claro los mdulos que son necesarios para tu cdigo y evita preguntas sobre "
"si el nombre del mdulo se encuentra en el mbito de la aplicacin. Usar una "
"importacin por lnea hace que sea sencillo aadir y eliminar mdulos "
"importados pero usar mltiples importaciones por lnea usa menos espacio de "
"pantalla."

#: ../Doc/faq/programming.rst:299
msgid "It's good practice if you import modules in the following order:"
msgstr "Es una buena prctica si importas los mdulos en el orden siguiente:"

#: ../Doc/faq/programming.rst:301
#, fuzzy
msgid ""
"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :"
"mod:`re`"
msgstr ""
"mdulos de la biblioteca estndar -- por ejemplo, ``sys``, ``os``, "
"``getopt``, ``re``"

#: ../Doc/faq/programming.rst:302
#, fuzzy
msgid ""
"third-party library modules (anything installed in Python's site-packages "
"directory) -- e.g. :mod:`!dateutil`, :mod:`!requests`, :mod:`!PIL.Image`"
msgstr ""
"mdulos de bibliotecas de terceros (cualquier cosa instalada en el "
"directorio *site-packages* de Python) -- por ejemplo, mx.DateTime, ZODB, PIL."
"Image, etc."

#: ../Doc/faq/programming.rst:304
#, fuzzy
msgid "locally developed modules"
msgstr "mdulos desarrollados localmente"

#: ../Doc/faq/programming.rst:306
msgid ""
"It is sometimes necessary to move imports to a function or class to avoid "
"problems with circular imports.  Gordon McMillan says:"
msgstr ""
"Hay veces en que es necesario mover las importaciones a una funcin o clase "
"para evitar problemas de importaciones circulares.  Gordon McMillan dice:"

#: ../Doc/faq/programming.rst:309
msgid ""
"Circular imports are fine where both modules use the \"import \" "
"form of import.  They fail when the 2nd module wants to grab a name out of "
"the first (\"from module import name\") and the import is at the top level.  "
"That's because names in the 1st are not yet available, because the first "
"module is busy importing the 2nd."
msgstr ""
"No hay problema con las importaciones circulares cuando ambos mdulos usan "
"la forma de importacin \"import \".  Fallar cuando el segundo "
"mdulo quiera coger un nombre del primer mdulo (\"from module import "
"name\") y la importacin se encuentre en el nivel superior.  Esto sucede "
"porque los nombres en el primero todava no se encuentran disponibles debido "
"a que el primer mdulo se encuentra ocupado importando al segundo."

#: ../Doc/faq/programming.rst:315
msgid ""
"In this case, if the second module is only used in one function, then the "
"import can easily be moved into that function.  By the time the import is "
"called, the first module will have finished initializing, and the second "
"module can do its import."
msgstr ""
"En este caso, si el segundo mdulo se usa solamente desde una funcin, la "
"importacin se puede mover de forma sencilla dentro de la funcin. En el "
"momento en que se invoca a la importacin el primer mdulo habr terminado "
"de inicializarse y el segundo mdulo podr hacer la importacin."

#: ../Doc/faq/programming.rst:320
msgid ""
"It may also be necessary to move imports out of the top level of code if "
"some of the modules are platform-specific.  In that case, it may not even be "
"possible to import all of the modules at the top of the file.  In this case, "
"importing the correct modules in the corresponding platform-specific code is "
"a good option."
msgstr ""
"Tambin podra ser necesario mover importaciones fuera del nivel superior "
"del cdigo si alguno de loa mdulos son especficos a la plataforma. En ese "
"caso podra, incluso, no ser posible importar todos los mdulos en la parte "
"superior del fichero. Para esos casos, la importacin correcta de los "
"mdulos en el cdigo correspondiente especfico de la plataforma es una "
"buena opcin."

#: ../Doc/faq/programming.rst:325
msgid ""
"Only move imports into a local scope, such as inside a function definition, "
"if it's necessary to solve a problem such as avoiding a circular import or "
"are trying to reduce the initialization time of a module.  This technique is "
"especially helpful if many of the imports are unnecessary depending on how "
"the program executes.  You may also want to move imports into a function if "
"the modules are only ever used in that function.  Note that loading a module "
"the first time may be expensive because of the one time initialization of "
"the module, but loading a module multiple times is virtually free, costing "
"only a couple of dictionary lookups.  Even if the module name has gone out "
"of scope, the module is probably available in :data:`sys.modules`."
msgstr ""
"Solo debes mover importaciones a un mbito de aplicacin local, como dentro "
"de la definicin de una funcin, si es necesario resolver problemas como una "
"importacin circular o al intentar reducir el tiempo de inicializacin de un "
"mdulo. Esta tcnica es especialmente til si muchas de las importaciones no "
"son necesarias dependiendo de cmo se ejecute el programa. Tambin podras "
"mover importaciones a una funcin si los mdulos solo se usan dentro de esa "
"funcin. Ntese que la primera carga de un mdulo puede ser costosa debido "
"al tiempo necesario para la inicializacin del mdulo,pero la carga de un "
"mdulo mltiples veces est prcticamente libre de coste ya que solo es "
"necesario hacer bsquedas en un diccionario. Incluso si el nombre del mdulo "
"ha salido del mbito de aplicacin el mdulo se encuentre, probablemente, "
"en :data:`sys.modules`."

#: ../Doc/faq/programming.rst:338
msgid "Why are default values shared between objects?"
msgstr "Por qu los valores por defecto se comparten entre objetos?"

#: ../Doc/faq/programming.rst:340
msgid ""
"This type of bug commonly bites neophyte programmers.  Consider this "
"function::"
msgstr ""
"Este tipo de error golpea a menudo a programadores novatos. Considera esta "
"funcin::"

#: ../Doc/faq/programming.rst:347
msgid ""
"The first time you call this function, ``mydict`` contains a single item.  "
"The second time, ``mydict`` contains two items because when ``foo()`` begins "
"executing, ``mydict`` starts out with an item already in it."
msgstr ""
"La primera vez que llamas a esta funcin, ``mydict`` solamente contiene un "
"nico elemento. La segunda vez, ``mydict`` contiene dos elementos debido a "
"que cuando comienza la ejecucin de ``foo()``, ``mydict`` comienza "
"conteniendo un elemento de partida."

#: ../Doc/faq/programming.rst:351
msgid ""
"It is often expected that a function call creates new objects for default "
"values. This is not what happens. Default values are created exactly once, "
"when the function is defined.  If that object is changed, like the "
"dictionary in this example, subsequent calls to the function will refer to "
"this changed object."
msgstr ""
"A menudo se esperara que una invocacin a una funcin cree nuevos objetos "
"para valores por defecto. Eso no es lo que realmente sucede. Los valores por "
"defecto se crean exactamente una sola vez, cuando se define la funcin. Se "
"se cambia el objeto, como el diccionario en este ejemplo, posteriores "
"invocaciones a la funcin estarn referidas al objeto cambiado."

#: ../Doc/faq/programming.rst:356
msgid ""
"By definition, immutable objects such as numbers, strings, tuples, and "
"``None``, are safe from change. Changes to mutable objects such as "
"dictionaries, lists, and class instances can lead to confusion."
msgstr ""
"Por definicin, los objetos inmutables como nmeros, cadenas, tuplas y "
"``None`` estn asegurados frente al cambio. Cambios en objetos mutables como "
"diccionarios, listas e instancias de clase pueden llevar a confusin."

#: ../Doc/faq/programming.rst:360
msgid ""
"Because of this feature, it is good programming practice to not use mutable "
"objects as default values.  Instead, use ``None`` as the default value and "
"inside the function, check if the parameter is ``None`` and create a new "
"list/dictionary/whatever if it is.  For example, don't write::"
msgstr ""
"Debido a esta caracterstica es una buena prctica de programacin el no "
"usar valores mutables como valores por defecto. En su lugar usa ``None`` "
"como valor por defecto dentro de la funcin, comprueba si el parmetro es "
"``None`` y crea una nueva lista/un nuevo diccionario/cualquier otras cosa "
"que necesites.  Por ejemplo, no escribas::"

#: ../Doc/faq/programming.rst:368
msgid "but::"
msgstr "pero::"

#: ../Doc/faq/programming.rst:374
msgid ""
"This feature can be useful.  When you have a function that's time-consuming "
"to compute, a common technique is to cache the parameters and the resulting "
"value of each call to the function, and return the cached value if the same "
"value is requested again.  This is called \"memoizing\", and can be "
"implemented like this::"
msgstr ""
"Esta caracterstica puede ser til. Cuando tienes una funcin que es muy "
"costosa de ejecutar, una tcnica comn es *cachear* sus parmetros y el "
"valor resultante de cada invocacin a la funcin y retornar el valor "
"*cacheado* si se solicita nuevamente el mismo valor.  A esto se le llama "
"\"memoizing\" y se puede implementar de la siguiente forma::"

#: ../Doc/faq/programming.rst:389
msgid ""
"You could use a global variable containing a dictionary instead of the "
"default value; it's a matter of taste."
msgstr ""
"Podras usar una variable global conteniendo un diccionario en lugar de un "
"valor por defecto; es una cuestin de gustos."

#: ../Doc/faq/programming.rst:394
msgid ""
"How can I pass optional or keyword parameters from one function to another?"
msgstr ""
"Cmo puedo pasar parmetros por palabra clave u opcionales de una funcin a "
"otra?"

#: ../Doc/faq/programming.rst:396
msgid ""
"Collect the arguments using the ``*`` and ``**`` specifiers in the "
"function's parameter list; this gives you the positional arguments as a "
"tuple and the keyword arguments as a dictionary.  You can then pass these "
"arguments when calling another function by using ``*`` and ``**``::"
msgstr ""
"Recopila los argumentos usando los especificadores ``*`` y ``**`` en la "
"lista de parmetros de la funcin; esto te proporciona los argumentos "
"posicionales como una tupla y los argumentos con palabras clave como un "
"diccionario.  Puedes, entonces, pasar estos argumentos cuando invoques a "
"otra funcin usando ``*`` y ``**``::"

#: ../Doc/faq/programming.rst:415
msgid "What is the difference between arguments and parameters?"
msgstr "Cul es la diferencia entre argumentos y parmetros?"

#: ../Doc/faq/programming.rst:417
#, fuzzy
msgid ""
":term:`Parameters ` are defined by the names that appear in a "
"function definition, whereas :term:`arguments ` are the values "
"actually passed to a function when calling it.  Parameters define what :term:"
"`kind of arguments ` a function can accept.  For example, given "
"the function definition::"
msgstr ""
":term:`Parmetros ` se definen mediante los nombres que aparecen "
"en la definicin de una funcin mientras que :term:`argumentos ` "
"son los valores que se pasan a la funcin cuando la invocamos.  Los "
"Parmetros definen qu tipos de argumentos puede aceptar una funcin.  por "
"ejemplo, dada la definicin de la funcin::"

#: ../Doc/faq/programming.rst:426
msgid ""
"*foo*, *bar* and *kwargs* are parameters of ``func``.  However, when calling "
"``func``, for example::"
msgstr ""
"*foo*, *bar* y *kwargs* son parmetros de ``func``.  Sin embargo, cuando "
"invocamos a ``func``, por ejemplo::"

#: ../Doc/faq/programming.rst:431
msgid "the values ``42``, ``314``, and ``somevar`` are arguments."
msgstr "los valores ``42``, ``314`` y ``somevar`` son argumentos."

#: ../Doc/faq/programming.rst:435
msgid "Why did changing list 'y' also change list 'x'?"
msgstr "Por qu cambiando la lista 'y' cambia, tambin, la lista 'x'?"

#: ../Doc/faq/programming.rst:437
msgid "If you wrote code like::"
msgstr "Si escribes cdigo como::"

#: ../Doc/faq/programming.rst:447
msgid ""
"you might be wondering why appending an element to ``y`` changed ``x`` too."
msgstr ""
"te estars preguntando porque aadir un elemento a ``y`` ha cambiado tambin "
"a ``x``."

#: ../Doc/faq/programming.rst:449
msgid "There are two factors that produce this result:"
msgstr "Hay dos factores que provocan este resultado:"

#: ../Doc/faq/programming.rst:451
msgid ""
"Variables are simply names that refer to objects.  Doing ``y = x`` doesn't "
"create a copy of the list -- it creates a new variable ``y`` that refers to "
"the same object ``x`` refers to.  This means that there is only one object "
"(the list), and both ``x`` and ``y`` refer to it."
msgstr ""
"Las variables son simplemente nombres que referencian a objetos.  Haciendo "
"``y = x`` no crea una copia de la lista -- crea una nueva variable ``y`` que "
"referencia al mismo objeto al que referencia ``x`` .  Esto significa que "
"solo existe un objeto (la lista) y tanto ``x`` como ``y`` hacen referencia "
"al mismo."

#: ../Doc/faq/programming.rst:455
msgid ""
"Lists are :term:`mutable`, which means that you can change their content."
msgstr ""
"Las listas son :term:`mutable`, lo que significa que puedes cambiar su "
"contenido."

#: ../Doc/faq/programming.rst:457
#, fuzzy
msgid ""
"After the call to :meth:`!append`, the content of the mutable object has "
"changed from ``[]`` to ``[10]``.  Since both the variables refer to the same "
"object, using either name accesses the modified value ``[10]``."
msgstr ""
"Despus de la invocacin a :meth:`~list.append`, el contenido del objeto "
"mutable ha cambiado de ``[]`` a ``[10]``.  Ya que ambas variables "
"referencian al mismo objeto, el usar cualquiera de los nombres acceder al "
"valor modificado ``[10]``."

#: ../Doc/faq/programming.rst:461
msgid "If we instead assign an immutable object to ``x``::"
msgstr "Si, por otra parte, asignamos un objeto inmutable a ``x``::"

#: ../Doc/faq/programming.rst:471
msgid ""
"we can see that in this case ``x`` and ``y`` are not equal anymore.  This is "
"because integers are :term:`immutable`, and when we do ``x = x + 1`` we are "
"not mutating the int ``5`` by incrementing its value; instead, we are "
"creating a new object (the int ``6``) and assigning it to ``x`` (that is, "
"changing which object ``x`` refers to).  After this assignment we have two "
"objects (the ints ``6`` and ``5``) and two variables that refer to them "
"(``x`` now refers to ``6`` but ``y`` still refers to ``5``)."
msgstr ""
"podemos ver que ``x`` e ``y`` ya no son iguales.  Esto es debido a que los "
"enteros son :term:`immutable`, y cuando hacemos ``x = x + 1`` no estamos "
"mutando el entero ``5`` incrementando su valor; en su lugar, estamos creando "
"un nuevo objeto (el entero ``6``) y se lo asignamos a ``x`` (esto es, "
"cambiando el objeto al cual referencia ``x``).  Despus de esta asignacin "
"tenemos dos objetos (los enteros ``6`` y ``5``) y dos variables que "
"referencian a ellos (``x`` ahora referencia a  ``6`` pero ``y`` todava "
"referencia a ``5``)."

#: ../Doc/faq/programming.rst:479
#, fuzzy
msgid ""
"Some operations (for example ``y.append(10)`` and ``y.sort()``) mutate the "
"object, whereas superficially similar operations (for example ``y = y + "
"[10]`` and :func:`sorted(y) `) create a new object.  In general in "
"Python (and in all cases in the standard library) a method that mutates an "
"object will return ``None`` to help avoid getting the two types of "
"operations confused.  So if you mistakenly write ``y.sort()`` thinking it "
"will give you a sorted copy of ``y``, you'll instead end up with ``None``, "
"which will likely cause your program to generate an easily diagnosed error."
msgstr ""
"Algunas operaciones (por ejemplo ``y.append(10)`` y ``y.sort()``) mutan al "
"objeto mientras que operaciones que podran parecer similares (por ejemplo "
"``y = y + [10]`` y ``sorted(y)``) crean un nuevo objeto.  En general, en "
"Python (y en todo momento en la biblioteca estndar) un mtodo que muta un "
"objeto retornar ``None`` para evitar tener dos tipos de operaciones que "
"puedan ser confusas.  Por tanto, si escribes accidentalmente ``y.sort()`` "
"pensando que te retornar una copia ordenada de ``y``, obtendrs, en su "
"lugar, ``None``, lo cual ayudar a que tu programa genera un error que pueda "
"ser diagnosticado fcilmente."

#: ../Doc/faq/programming.rst:488
msgid ""
"However, there is one class of operations where the same operation sometimes "
"has different behaviors with different types:  the augmented assignment "
"operators.  For example, ``+=`` mutates lists but not tuples or ints "
"(``a_list += [1, 2, 3]`` is equivalent to ``a_list.extend([1, 2, 3])`` and "
"mutates ``a_list``, whereas ``some_tuple += (1, 2, 3)`` and ``some_int += "
"1`` create new objects)."
msgstr ""
"Sin embargo, existe una clase de operaciones en las cuales la misma "
"operacin tiene, a veces, distintos comportamientos con diferentes tipos:  "
"los operadores de asignacin aumentada.  Por ejemplo, ``+=`` muta listas "
"pero no tuplas o enteros (``a_list += [1, 2, 3]`` es equivalente a ``a_list."
"extend([1, 2, 3])`` y muta ``a_list``, mientras que ``some_tuple += (1, 2, "
"3)`` y ``some_int += 1`` crea nuevos objetos)."

#: ../Doc/faq/programming.rst:495
msgid "In other words:"
msgstr "En otras palabras:"

#: ../Doc/faq/programming.rst:497
msgid ""
"If we have a mutable object (:class:`list`, :class:`dict`, :class:`set`, "
"etc.), we can use some specific operations to mutate it and all the "
"variables that refer to it will see the change."
msgstr ""
"Si tenemos un objeto mutable (:class:`list`, :class:`dict`, :class:`set`, "
"etc.), podemos usar algunas operaciones especficas para mutarlo y todas las "
"variables que referencian al mismo vern el cambio reflejado."

#: ../Doc/faq/programming.rst:500
msgid ""
"If we have an immutable object (:class:`str`, :class:`int`, :class:`tuple`, "
"etc.), all the variables that refer to it will always see the same value, "
"but operations that transform that value into a new value always return a "
"new object."
msgstr ""
"Si tenemos un objeto inmutable (:class:`str`, :class:`int`, :class:`tuple`, "
"etc.), todas las variables que referencian al mismo vern siempre el mismo "
"valor pero las operaciones que transforman ese valor en un nuevo valor "
"siempre retornan un nuevo objeto."

#: ../Doc/faq/programming.rst:505
msgid ""
"If you want to know if two variables refer to the same object or not, you "
"can use the :keyword:`is` operator, or the built-in function :func:`id`."
msgstr ""
"Si deseas saber si dos variables referencian o no al mismo objeto puedes "
"usar el operador :keyword:`is` o la funcin incorporada :func:`id`."

#: ../Doc/faq/programming.rst:510
msgid "How do I write a function with output parameters (call by reference)?"
msgstr ""
"Cmo puedo escribir una funcin sin parmetros (invocacin mediante "
"referencia)?"

#: ../Doc/faq/programming.rst:512
msgid ""
"Remember that arguments are passed by assignment in Python.  Since "
"assignment just creates references to objects, there's no alias between an "
"argument name in the caller and callee, and so no call-by-reference per se.  "
"You can achieve the desired effect in a number of ways."
msgstr ""
"Recuerda que los argumentos son pasados mediante asignacin en Python.  Ya "
"que las asignaciones simplemente crean referencias a objetos, no hay alias "
"entre el nombre de un argumento en el invocador y el invocado y, por tanto, "
"no hay invocacin por referencia per se.  Puedes obtener el mismo efecto "
"deseado de formas distintas."

#: ../Doc/faq/programming.rst:517
msgid "By returning a tuple of the results::"
msgstr "Mediante el retorno de una tupla de resultados::"

#: ../Doc/faq/programming.rst:528
msgid "This is almost always the clearest solution."
msgstr "Esta es, casi siempre, la solucin ms clara."

#: ../Doc/faq/programming.rst:530
msgid ""
"By using global variables.  This isn't thread-safe, and is not recommended."
msgstr ""
"Mediante el uso de variables globales.  No es thread-safe y no se recomienda."

#: ../Doc/faq/programming.rst:532
msgid "By passing a mutable (changeable in-place) object::"
msgstr "Pasando un objeto mutable (intercambiable en el mismo sitio)::"

#: ../Doc/faq/programming.rst:543
msgid "By passing in a dictionary that gets mutated::"
msgstr "Pasando un diccionario que muta::"

#: ../Doc/faq/programming.rst:554
msgid "Or bundle up values in a class instance::"
msgstr "O empaquetar valores en una instancia de clase::"

#: ../Doc/faq/programming.rst:571
msgid "There's almost never a good reason to get this complicated."
msgstr "Casi nunca existe una buena razn para hacer esto tan complicado."

#: ../Doc/faq/programming.rst:573
msgid "Your best choice is to return a tuple containing the multiple results."
msgstr ""
"Tu mejor opcin es retornar una tupla que contenga los mltiples resultados."

#: ../Doc/faq/programming.rst:577
msgid "How do you make a higher order function in Python?"
msgstr "Cmo se puede hacer una funcin de orden superior en Python?"

#: ../Doc/faq/programming.rst:579
msgid ""
"You have two choices: you can use nested scopes or you can use callable "
"objects. For example, suppose you wanted to define ``linear(a,b)`` which "
"returns a function ``f(x)`` that computes the value ``a*x+b``.  Using nested "
"scopes::"
msgstr ""
"Tienes dos opciones: puedes usar mbitos de aplicacin anidados o puedes "
"usar objetos invocables. Por ejemplo, supn que queras definir ``linear(a,"
"b)`` que devuelve una funcin ``f(x)`` que calcula el valor ``a*x+b``.  Usar "
"mbitos de aplicacin anidados::"

#: ../Doc/faq/programming.rst:588
msgid "Or using a callable object::"
msgstr "O usar un objeto invocable::"

#: ../Doc/faq/programming.rst:598
msgid "In both cases, ::"
msgstr "En ambos casos, ::"

#: ../Doc/faq/programming.rst:602
msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``."
msgstr "nos da un objeto invocable donde ``taxes(10e6) == 0.3 * 10e6 + 2``."

#: ../Doc/faq/programming.rst:604
msgid ""
"The callable object approach has the disadvantage that it is a bit slower "
"and results in slightly longer code.  However, note that a collection of "
"callables can share their signature via inheritance::"
msgstr ""
"El enfoque del objeto invocable tiene la desventaja que es un ligeramente "
"ms lento y el resultado es un cdigo levemente ms largo.  Sin embargo, "
"destacar que una coleccin de invocables pueden compartir su firma va "
"herencia::"

#: ../Doc/faq/programming.rst:613
msgid "Object can encapsulate state for several methods::"
msgstr "Los objetos pueden encapsular el estado de varios mtodos::"

#: ../Doc/faq/programming.rst:631
msgid ""
"Here ``inc()``, ``dec()`` and ``reset()`` act like functions which share the "
"same counting variable."
msgstr ""
"Aqu ``inc()``, ``dec()`` y ``reset()`` se comportan como funciones las "
"cuales comparten la misma variable de conteo."

#: ../Doc/faq/programming.rst:636
msgid "How do I copy an object in Python?"
msgstr "Cmo copio un objeto en Python?"

#: ../Doc/faq/programming.rst:638
msgid ""
"In general, try :func:`copy.copy` or :func:`copy.deepcopy` for the general "
"case. Not all objects can be copied, but most can."
msgstr ""
"En general, prueba :func:`copy.copy` o :func:`copy.deepcopy` para el caso "
"general. No todos los objetos se pueden copiar pero la mayora s que pueden "
"copiarse."

#: ../Doc/faq/programming.rst:641
msgid ""
"Some objects can be copied more easily.  Dictionaries have a :meth:`~dict."
"copy` method::"
msgstr ""
"Algunas objetos se pueden copiar de forma ms sencilla. Los diccionarios "
"disponen de un mtodo :meth:`~dict.copy`::"

#: ../Doc/faq/programming.rst:646
msgid "Sequences can be copied by slicing::"
msgstr "Las secuencias se pueden copiar usando un rebanado::"

#: ../Doc/faq/programming.rst:652
msgid "How can I find the methods or attributes of an object?"
msgstr "Cmo puedo encontrar los mtodos o atributos de un objeto?"

#: ../Doc/faq/programming.rst:654
#, fuzzy
msgid ""
"For an instance ``x`` of a user-defined class, :func:`dir(x) ` returns "
"an alphabetized list of the names containing the instance attributes and "
"methods and attributes defined by its class."
msgstr ""
"Para la instancia x de una clase definida por el usuario, ``dir(x)`` "
"devuelve una lista de nombres ordenados alfabticamente que contiene los "
"atributos y mtodos de la instancia y los atributos definidos mediante su "
"clase."

#: ../Doc/faq/programming.rst:660
msgid "How can my code discover the name of an object?"
msgstr "Cmo puede mi cdigo descubrir el nombre de un objeto?"

#: ../Doc/faq/programming.rst:662
msgid ""
"Generally speaking, it can't, because objects don't really have names. "
"Essentially, assignment always binds a name to a value; the same is true of "
"``def`` and ``class`` statements, but in that case the value is a callable. "
"Consider the following code::"
msgstr ""
"Hablando de forma general no podran puesto que los objetos no disponen, "
"realmente, de un nombre. Esencialmente, las asignaciones relacionan un "
"nombre con su valor; Lo mismo se cumple con las declaraciones ``def`` y "
"``class`` pero, en este caso, el valor es un invocable. Considera el "
"siguiente cdigo::"

#: ../Doc/faq/programming.rst:678
#, fuzzy
msgid ""
"Arguably the class has a name: even though it is bound to two names and "
"invoked through the name ``B`` the created instance is still reported as an "
"instance of class ``A``.  However, it is impossible to say whether the "
"instance's name is ``a`` or ``b``, since both names are bound to the same "
"value."
msgstr ""
"Podra decirse que la clase tiene un nombre: aunque est ligada a dos "
"nombres y se invoca a travs del nombre B, la instancia creada se sigue "
"reportando como una instancia de la clase A. Sin embargo, es imposible decir "
"si el nombre de la instancia es a o b, ya que ambos nombres estn ligados al "
"mismo valor."

#: ../Doc/faq/programming.rst:683
msgid ""
"Generally speaking it should not be necessary for your code to \"know the "
"names\" of particular values. Unless you are deliberately writing "
"introspective programs, this is usually an indication that a change of "
"approach might be beneficial."
msgstr ""
"En trminos generales, no debera ser necesario que tu cdigo \"conozca los "
"nombres\" de determinados valores. A menos que ests escribiendo "
"deliberadamente programas introspectivos, esto suele ser una indicacin de "
"que un cambio de enfoque podra ser beneficioso."

#: ../Doc/faq/programming.rst:688
msgid ""
"In comp.lang.python, Fredrik Lundh once gave an excellent analogy in answer "
"to this question:"
msgstr ""
"En comp.lang.python, Fredrik Lundh proporcion una vez una excelente "
"analoga en respuesta a esta pregunta:"

#: ../Doc/faq/programming.rst:691
msgid ""
"The same way as you get the name of that cat you found on your porch: the "
"cat (object) itself cannot tell you its name, and it doesn't really care -- "
"so the only way to find out what it's called is to ask all your neighbours "
"(namespaces) if it's their cat (object)..."
msgstr ""
"De la misma forma que obtienes el nombre de ese gato que te has encontrado "
"en tu porche el propio gato (objeto) no te puede indicar su nombre y, "
"realmente, no importa -- por tanto, la nica forma de encontrar cmo se "
"llama sera preguntando a todos los vecinos (espacios de nombres) si es su "
"gato (objeto)..."

#: ../Doc/faq/programming.rst:696
msgid ""
"....and don't be surprised if you'll find that it's known by many names, or "
"no name at all!"
msgstr ""
"...y no te sorprendas si encuentras que se le conoce mediante diferentes "
"nombres o nadie conoce su nombre!"

#: ../Doc/faq/programming.rst:701
msgid "What's up with the comma operator's precedence?"
msgstr "Qu ocurre con la precedencia del operador coma?"

#: ../Doc/faq/programming.rst:703
msgid "Comma is not an operator in Python.  Consider this session::"
msgstr "La coma no es un operador en Python. Considera la sesin::"

#: ../Doc/faq/programming.rst:708
msgid ""
"Since the comma is not an operator, but a separator between expressions the "
"above is evaluated as if you had entered::"
msgstr ""
"Debido a que la coma no es un operador sino un  separador entre expresiones "
"lo anterior se evale como se ha introducido::"

#: ../Doc/faq/programming.rst:713
msgid "not::"
msgstr "no::"

#: ../Doc/faq/programming.rst:717
msgid ""
"The same is true of the various assignment operators (``=``, ``+=`` etc).  "
"They are not truly operators but syntactic delimiters in assignment "
"statements."
msgstr ""
"Lo mismo sucede con varios operadores de asignacin (``=``, ``+=``, etc).  "
"No son realmente operadores sino delimitadores sintcticos en declaraciones "
"de asignacin."

#: ../Doc/faq/programming.rst:722
msgid "Is there an equivalent of C's \"?:\" ternary operator?"
msgstr "Existe un equivalente al operador ternario de C \"?:\"?"

#: ../Doc/faq/programming.rst:724
msgid "Yes, there is. The syntax is as follows::"
msgstr "S, existe. La sintaxis es como sigue::"

#: ../Doc/faq/programming.rst:731
msgid ""
"Before this syntax was introduced in Python 2.5, a common idiom was to use "
"logical operators::"
msgstr ""
"Antes de que esta sintaxis se introdujera en Python 2.5 una expresin comn "
"fue el uso de operadores lgicos::"

#: ../Doc/faq/programming.rst:736
msgid ""
"However, this idiom is unsafe, as it can give wrong results when *on_true* "
"has a false boolean value.  Therefore, it is always better to use the ``... "
"if ... else ...`` form."
msgstr ""
"Sin embargo, esa expresin no es segura ya que puede retornar valores "
"errneos cuando *on_true* tiene un valor booleano falso.  Por tanto, siempre "
"es mejor usar la forma ``... if ... else ...``."

#: ../Doc/faq/programming.rst:742
msgid "Is it possible to write obfuscated one-liners in Python?"
msgstr ""
"Es posible escribir expresiones en una lnea de forma ofuscada en Python?"

#: ../Doc/faq/programming.rst:744
#, fuzzy
msgid ""
"Yes.  Usually this is done by nesting :keyword:`lambda` within :keyword:`!"
"lambda`.  See the following three examples, slightly adapted from Ulf "
"Bartelt::"
msgstr ""
"S.  Normalmente se puede hacer anidando :keyword:`lambda` dentro de :"
"keyword:`!lambda`.  Examina los siguientes tres ejemplos, creados por Ulf "
"Bartelt::"

#: ../Doc/faq/programming.rst:771
msgid "Don't try this at home, kids!"
msgstr "No probis esto en casa, personitas!"

#: ../Doc/faq/programming.rst:777
msgid "What does the slash(/) in the parameter list of a function mean?"
msgstr ""
"Qu hace la barra (/) en medio de la lista de parmetros de una funcin?"

#: ../Doc/faq/programming.rst:779
#, fuzzy
msgid ""
"A slash in the argument list of a function denotes that the parameters prior "
"to it are positional-only.  Positional-only parameters are the ones without "
"an externally usable name.  Upon calling a function that accepts positional-"
"only parameters, arguments are mapped to parameters based solely on their "
"position. For example, :func:`divmod` is a function that accepts positional-"
"only parameters. Its documentation looks like this::"
msgstr ""
"Un *slash* en la lista de argumentos de una funcin denota que los "
"parmetros previos al mismo son nicamente posicionales.  Parmetros "
"nicamente posicionales son aquellos cuyos nombres no son usables "
"internamente.  Mediante la llamada a una funcin que acepta parmetros "
"nicamente posicionales, los argumentos se mapean a parmetros basados "
"nicamente en su posicin. Por ejemplo, :func:`pow` es una funcin que "
"acepta parmetros nicamente posicionales. Su documentacin es de la "
"siguiente forma::"

#: ../Doc/faq/programming.rst:792
msgid ""
"The slash at the end of the parameter list means that both parameters are "
"positional-only. Thus, calling :func:`divmod` with keyword arguments would "
"lead to an error::"
msgstr ""
"El *slash* al final de la lista de parmetros indica que los tres parmetros "
"son nicamente posicionales. Por tanto, invocar a  :func:`pow` con "
"argumentos con palabra clave podra derivar en un error::"

#: ../Doc/faq/programming.rst:803
msgid "Numbers and strings"
msgstr "Nmeros y cadenas"

#: ../Doc/faq/programming.rst:806
msgid "How do I specify hexadecimal and octal integers?"
msgstr "Cmo puedo especificar enteros hexadecimales y octales?"

#: ../Doc/faq/programming.rst:808
msgid ""
"To specify an octal digit, precede the octal value with a zero, and then a "
"lower or uppercase \"o\".  For example, to set the variable \"a\" to the "
"octal value \"10\" (8 in decimal), type::"
msgstr ""
"Para especificar un dgito octal, prefija el valor octal con un cero y una "
"\"o\" en minscula o mayscula.  Por ejemplo, para definir la variable \"a\" "
"con el valor octal \"10\" (8 en decimal), escribe::"

#: ../Doc/faq/programming.rst:816
msgid ""
"Hexadecimal is just as easy.  Simply precede the hexadecimal number with a "
"zero, and then a lower or uppercase \"x\".  Hexadecimal digits can be "
"specified in lower or uppercase.  For example, in the Python interpreter::"
msgstr ""
"Un hexadecimal es igual de simple.  Simplemente aade un cero y una \"x\", "
"en minscula o mayscula, antes del nmero hexadecimal . Los dgitos "
"hexadecimales se pueden especificar en minsculas o maysculas.  Por "
"ejemplo, en el intrprete de Python::"

#: ../Doc/faq/programming.rst:829
msgid "Why does -22 // 10 return -3?"
msgstr "Por qu -22 // 10 devuelve -3?"

#: ../Doc/faq/programming.rst:831
msgid ""
"It's primarily driven by the desire that ``i % j`` have the same sign as "
"``j``. If you want that, and also want::"
msgstr ""
"Es debido, principalmente al deseo que ``i % j`` tenga el mismo signo que "
"``j``. Si quieres eso y, adems, quieres::"

#: ../Doc/faq/programming.rst:836
msgid ""
"then integer division has to return the floor.  C also requires that "
"identity to hold, and then compilers that truncate ``i // j`` need to make "
"``i % j`` have the same sign as ``i``."
msgstr ""
"entonces la divisin entera a la baja debe retornar el valor base ms bajo. "
"C tambin requiere que esa identidad se mantenga de tal forma que cuando los "
"compiladores truncan ``i // j`` necesitan que ``i % j`` tenga el mismo signo "
"que ``i``."

#: ../Doc/faq/programming.rst:840
msgid ""
"There are few real use cases for ``i % j`` when ``j`` is negative.  When "
"``j`` is positive, there are many, and in virtually all of them it's more "
"useful for ``i % j`` to be ``>= 0``.  If the clock says 10 now, what did it "
"say 200 hours ago?  ``-190 % 12 == 2`` is useful; ``-190 % 12 == -10`` is a "
"bug waiting to bite."
msgstr ""
"Existen unos pocos casos para ``i % j`` cuando ``j`` es negativo.  Cuando "
"``j`` es positivo, existen muchos casos y, virtualmente, en todos ellos es "
"ms til para ``i % j`` que sea ``>= 0``.  Si el reloj dice que ahora son "
"las 10, qu dijo hace 200 horas?  ``-190 % 12 == 2`` es til; ``-190 % 12 "
"== -10`` es un error listo para morderte."

#: ../Doc/faq/programming.rst:848
msgid "How do I get int literal attribute instead of SyntaxError?"
msgstr "Cmo puedo obtener un atributo int literal en lugar de SyntaxError?"

#: ../Doc/faq/programming.rst:850
#, fuzzy
msgid ""
"Trying to lookup an ``int`` literal attribute in the normal manner gives a :"
"exc:`SyntaxError` because the period is seen as a decimal point::"
msgstr ""
"Al intentar buscar un atributo literal ``int`` de la manera normal se "
"obtiene un error de sintaxis porque el punto es interpretado como un punto "
"decimal::"

#: ../Doc/faq/programming.rst:859
msgid ""
"The solution is to separate the literal from the period with either a space "
"or parentheses."
msgstr ""
"La solucin es separar el literal del punto con un espacio o un parntesis."

#: ../Doc/faq/programming.rst:869
msgid "How do I convert a string to a number?"
msgstr "Cmo convierto una cadena a un nmero?"

#: ../Doc/faq/programming.rst:871
msgid ""
"For integers, use the built-in :func:`int` type constructor, e.g. "
"``int('144') == 144``.  Similarly, :func:`float` converts to floating-point, "
"e.g. ``float('144') == 144.0``."
msgstr ""
"Para enteros puedes usar la funcin incorporada constructor de tipos :func:"
"`int`, por ejemplo ``int('144') == 144``.  De forma similar, :func:`float` "
"convierte a un nmero de coma flotante, por ejemplo ``float('144') == "
"144.0``."

#: ../Doc/faq/programming.rst:875
msgid ""
"By default, these interpret the number as decimal, so that ``int('0144') == "
"144`` holds true, and ``int('0x144')`` raises :exc:`ValueError`. "
"``int(string, base)`` takes the base to convert from as a second optional "
"argument, so ``int( '0x144', 16) == 324``.  If the base is specified as 0, "
"the number is interpreted using Python's rules: a leading '0o' indicates "
"octal, and '0x' indicates a hex number."
msgstr ""
"Por defecto, estas interpretan el nmero como decimal de tal forma que "
"``int('0144') == 144`` y ``int('0x144')`` lanzar :exc:`ValueError`. "
"``int(string, base)`` toma la base para convertirlo desde un segundo "
"parmetro opcional, por tanto ``int('0x144', 16) == 324``. Si la base se "
"especifica como 0, el nmero se interpreta usando las reglas de Python's "
"rules: un prefijo '0o' indica octal y un prefijo '0x' indica un nmero "
"hexadecimal."

#: ../Doc/faq/programming.rst:882
msgid ""
"Do not use the built-in function :func:`eval` if all you need is to convert "
"strings to numbers.  :func:`eval` will be significantly slower and it "
"presents a security risk: someone could pass you a Python expression that "
"might have unwanted side effects.  For example, someone could pass "
"``__import__('os').system(\"rm -rf $HOME\")`` which would erase your home "
"directory."
msgstr ""
"No uses la funcin incorporada :func:`eval` si todo lo que necesitas es "
"convertir cadenas a nmeros.  :func:`eval` ser considerablemente ms lento "
"y presenta riesgos de seguridad: cualquiera podra introducir una expresin "
"Python que presentara efectos indeseados.  Por ejemplo, alguien podra pasar "
"``__import__('os').system(\"rm -rf $HOME\")`` lo cual borrara el directorio "
"home al completo."

#: ../Doc/faq/programming.rst:889
msgid ""
":func:`eval` also has the effect of interpreting numbers as Python "
"expressions, so that e.g. ``eval('09')`` gives a syntax error because Python "
"does not allow leading '0' in a decimal number (except '0')."
msgstr ""
":func:`eval` tambin tiene el efecto de interpretar nmeros como expresiones "
"Python , de tal forma que, por ejemplo, ``eval('09')`` dar un error de "
"sintaxis porque Python no permite un '0' inicial en un nmero decimal "
"(excepto '0')."

#: ../Doc/faq/programming.rst:895
msgid "How do I convert a number to a string?"
msgstr "Cmo puedo convertir un nmero a una cadena?"

#: ../Doc/faq/programming.rst:897
#, fuzzy
msgid ""
"To convert, e.g., the number ``144`` to the string ``'144'``, use the built-"
"in type constructor :func:`str`.  If you want a hexadecimal or octal "
"representation, use the built-in functions :func:`hex` or :func:`oct`.  For "
"fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` "
"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"."
"format(1.0/3.0)`` yields ``'0.333'``."
msgstr ""
"Para convertir, por ejemplo, el nmero 144 a la cadena '144', usa el "
"constructor de tipos incorporado :func:`str`.  Si deseas una representacin "
"hexadecimal o octal usa la funcin incorporada :func:`hex` o :func:`oct`.  "
"Para un formateado elaborado puedes ver las secciones de :ref:`f-strings` y :"
"ref:`formatstrings`, por ejemplo ``\"{:04d}\".format(144)`` produce "
"``'0144'`` y ``\"{:.3f}\".format(1.0/3.0)`` produce ``'0.333'``."

#: ../Doc/faq/programming.rst:906
msgid "How do I modify a string in place?"
msgstr "Cmo puedo modificar una cadena in situ?"

#: ../Doc/faq/programming.rst:908
msgid ""
"You can't, because strings are immutable.  In most situations, you should "
"simply construct a new string from the various parts you want to assemble it "
"from.  However, if you need an object with the ability to modify in-place "
"unicode data, try using an :class:`io.StringIO` object or the :mod:`array` "
"module::"
msgstr ""
"No puedes debido a que las cadenas son inmutables.  En la mayora de "
"situaciones solo deberas crear una nueva cadena a partir de varias partes "
"que quieras usar para crearla.  Sin embargo, si necesitas un objeto con la "
"habilidad de modificar en el mismo lugar datos unicode prueba usando el "
"objeto :class:`io.StringIO` o el mdulo :mod:`array`::"

#: ../Doc/faq/programming.rst:938
msgid "How do I use strings to call functions/methods?"
msgstr "Cmo puedo usar cadenas para invocar funciones/mtodos?"

#: ../Doc/faq/programming.rst:940
msgid "There are various techniques."
msgstr "Existen varias tcnicas."

#: ../Doc/faq/programming.rst:942
msgid ""
"The best is to use a dictionary that maps strings to functions.  The primary "
"advantage of this technique is that the strings do not need to match the "
"names of the functions.  This is also the primary technique used to emulate "
"a case construct::"
msgstr ""
"Lo mejor sera usar un diccionario que mapee cadenas a funciones.  La "
"principal ventaja de esta tcnica es que las cadenas no necesitan ser "
"iguales que los nombres de las funciones.  Esta es tambin la principal "
"tcnica que se usa para emular un constructo *case*::"

#: ../Doc/faq/programming.rst:957
msgid "Use the built-in function :func:`getattr`::"
msgstr "Usa la funcin incorporada :func:`getattr`::"

#: ../Doc/faq/programming.rst:962
msgid ""
"Note that :func:`getattr` works on any object, including classes, class "
"instances, modules, and so on."
msgstr ""
"Ntese que :func:`getattr` funciona en cualquier objeto, incluido clases, "
"instancias de clases, mdulos, etc."

#: ../Doc/faq/programming.rst:965
msgid "This is used in several places in the standard library, like this::"
msgstr "Esto se usa en varios lugares de la biblioteca estndar, como esto::"

#: ../Doc/faq/programming.rst:978
msgid "Use :func:`locals` to resolve the function name::"
msgstr "Use :func:`locals` para resolver el nombre de la funcin::"

#: ../Doc/faq/programming.rst:990
msgid ""
"Is there an equivalent to Perl's chomp() for removing trailing newlines from "
"strings?"
msgstr ""
"Existe un equivalente a chomp() en Perl para eliminar nuevas lneas al "
"final de las cadenas?"

#: ../Doc/faq/programming.rst:992
msgid ""
"You can use ``S.rstrip(\"\\r\\n\")`` to remove all occurrences of any line "
"terminator from the end of the string ``S`` without removing other trailing "
"whitespace.  If the string ``S`` represents more than one line, with several "
"empty lines at the end, the line terminators for all the blank lines will be "
"removed::"
msgstr ""
"Puedes usar ``S.rstrip(\"\\r\\n\")`` para eliminar todas las ocurrencias de "
"cualquier terminacin de lnea desde el final de la cadena ``S`` sin "
"eliminar el resto de espacios en blanco que le siguen. Si la cadena ``S`` "
"representa ms de una lnea con varias lneas vacas al final, las "
"terminaciones de lnea para todas las lneas vacas se eliminarn::"

#: ../Doc/faq/programming.rst:1004
msgid ""
"Since this is typically only desired when reading text one line at a time, "
"using ``S.rstrip()`` this way works well."
msgstr ""
"Ya que esto solo sera deseable, tpicamente, cuando lees texto lnea a "
"lnea, usar ``S.rstrip()`` de esta forma funcionara bien."

#: ../Doc/faq/programming.rst:1009
msgid "Is there a scanf() or sscanf() equivalent?"
msgstr "Existe un equivalente a scanf() o a sscanf() ?"

#: ../Doc/faq/programming.rst:1011
msgid "Not as such."
msgstr "No de la misma forma."

#: ../Doc/faq/programming.rst:1013
#, fuzzy
msgid ""
"For simple input parsing, the easiest approach is usually to split the line "
"into whitespace-delimited words using the :meth:`~str.split` method of "
"string objects and then convert decimal strings to numeric values using :"
"func:`int` or :func:`float`.  :meth:`!split()` supports an optional \"sep\" "
"parameter which is useful if the line uses something other than whitespace "
"as a separator."
msgstr ""
"Para anlisis sintctico simple de la entrada, el mtodo ms sencillo es, "
"usualmente, el separar la lnea en palabras delimitadas por espacios usando "
"el mtodo :meth:`~str.split` de los objetos *string* y, posteriormente, "
"convertir cadenas decimales a valores usando :func:`int` o :func:`float`.  "
"``split()`` permite un parmetro opcional \"sep\" que es til si la lnea "
"usa algo diferente a espacios en blanco como separador."

#: ../Doc/faq/programming.rst:1019
#, fuzzy
msgid ""
"For more complicated input parsing, regular expressions are more powerful "
"than C's ``sscanf`` and better suited for the task."
msgstr ""
"Para anlisis sintctico de la entrada ms complejo, las expresiones "
"regulares son ms poderosas que :c:func:`sscanf` de C  y se ajustan mejor a "
"esta tarea."

#: ../Doc/faq/programming.rst:1024
msgid "What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error  mean?"
msgstr "Qu significa 'UnicodeDecodeError' o 'UnicodeEncodeError'?"

#: ../Doc/faq/programming.rst:1026
msgid "See the :ref:`unicode-howto`."
msgstr "Ver :ref:`unicode-howto`."

#: ../Doc/faq/programming.rst:1032
msgid "Can I end a raw string with an odd number of backslashes?"
msgstr ""

#: ../Doc/faq/programming.rst:1034
msgid ""
"A raw string ending with an odd number of backslashes will escape the "
"string's quote::"
msgstr ""

#: ../Doc/faq/programming.rst:1042
msgid ""
"There are several workarounds for this. One is to use regular strings and "
"double the backslashes::"
msgstr ""

#: ../Doc/faq/programming.rst:1048
msgid ""
"Another is to concatenate a regular string containing an escaped backslash "
"to the raw string::"
msgstr ""

#: ../Doc/faq/programming.rst:1054
msgid ""
"It is also possible to use :func:`os.path.join` to append a backslash on "
"Windows::"
msgstr ""

#: ../Doc/faq/programming.rst:1059
msgid ""
"Note that while a backslash will \"escape\" a quote for the purposes of "
"determining where the raw string ends, no escaping occurs when interpreting "
"the value of the raw string. That is, the backslash remains present in the "
"value of the raw string::"
msgstr ""

#: ../Doc/faq/programming.rst:1067
msgid "Also see the specification in the :ref:`language reference `."
msgstr ""

#: ../Doc/faq/programming.rst:1070
msgid "Performance"
msgstr "Rendimiento"

#: ../Doc/faq/programming.rst:1073
msgid "My program is too slow. How do I speed it up?"
msgstr "Mi programa es muy lento. Cmo puedo acelerarlo?"

#: ../Doc/faq/programming.rst:1075
msgid ""
"That's a tough one, in general.  First, here are a list of things to "
"remember before diving further:"
msgstr ""
"Esa es una pregunta difcil, en general.  Primero, aqu tienes una lista de "
"cosas a recordar antes de ir ms all:"

#: ../Doc/faq/programming.rst:1078
msgid ""
"Performance characteristics vary across Python implementations.  This FAQ "
"focuses on :term:`CPython`."
msgstr ""
"Las caractersticas del rendimiento varan entre las distintas "
"implementaciones de Python.  Estas preguntas frecuentes se enfocan en :term:"
"`CPython`."

#: ../Doc/faq/programming.rst:1080
msgid ""
"Behaviour can vary across operating systems, especially when talking about I/"
"O or multi-threading."
msgstr ""
"El comportamiento puede variar entre distintos sistemas operativos, "
"especialmente cuando se habla de tareas I/O o multi-tarea."

#: ../Doc/faq/programming.rst:1082
msgid ""
"You should always find the hot spots in your program *before* attempting to "
"optimize any code (see the :mod:`profile` module)."
msgstr ""
"Siempre deberas encontrar las partes importantes en tu programa *antes* de "
"intentar optimizar el cdigo (ver el mdulo :mod:`profile`)."

#: ../Doc/faq/programming.rst:1084
msgid ""
"Writing benchmark scripts will allow you to iterate quickly when searching "
"for improvements (see the :mod:`timeit` module)."
msgstr ""
"Escribir programas de comparacin del rendimiento te permitir iterar "
"rpidamente cuando te encuentres buscando mejoras (ver el mdulo :mod:"
"`timeit`)."

#: ../Doc/faq/programming.rst:1086
msgid ""
"It is highly recommended to have good code coverage (through unit testing or "
"any other technique) before potentially introducing regressions hidden in "
"sophisticated optimizations."
msgstr ""
"Es altamente recomendable disponer de una buena cobertura de cdigo (a "
"partir de pruebas unitarias o cualquier otra tcnica) antes de introducir "
"potenciales regresiones ocultas en sofisticadas optimizaciones."

#: ../Doc/faq/programming.rst:1090
msgid ""
"That being said, there are many tricks to speed up Python code.  Here are "
"some general principles which go a long way towards reaching acceptable "
"performance levels:"
msgstr ""
"Dicho lo anterior, existen muchos trucos para acelerar cdigo Python.  Aqu "
"tienes algunos principios generales que te permitirn llegar a alcanzar "
"niveles de rendimiento aceptables:"

#: ../Doc/faq/programming.rst:1094
msgid ""
"Making your algorithms faster (or changing to faster ones) can yield much "
"larger benefits than trying to sprinkle micro-optimization tricks all over "
"your code."
msgstr ""
"El hacer ms rpido tu algoritmo (o cambiarlo por alguno ms rpido) puede "
"provocar mayores beneficios que intentar unos pocos trucos de micro-"
"optimizacin a travs de todo tu cdigo."

#: ../Doc/faq/programming.rst:1098
msgid ""
"Use the right data structures.  Study documentation for the :ref:`bltin-"
"types` and the :mod:`collections` module."
msgstr ""
"Utiliza las estructuras de datos correctas.  Estudia la documentacin para "
"los :ref:`bltin-types` y el mdulo :mod:`collections`."

#: ../Doc/faq/programming.rst:1101
msgid ""
"When the standard library provides a primitive for doing something, it is "
"likely (although not guaranteed) to be faster than any alternative you may "
"come up with.  This is doubly true for primitives written in C, such as "
"builtins and some extension types.  For example, be sure to use either the :"
"meth:`list.sort` built-in method or the related :func:`sorted` function to "
"do sorting (and see the :ref:`sortinghowto` for examples of moderately "
"advanced usage)."
msgstr ""
"Cuando la biblioteca estndar proporciona una primitiva de hacer algo, esta "
"supuestamente ser (aunque no se garantiza) ms rpida que cualquier otra "
"alternativa que se te ocurra.  Esto es doblemente cierto si las primitivas "
"han sido escritas en C, como los *builtins* y algunos tipos extendidos.  Por "
"ejemplo, asegrate de usar el mtodo integrado :meth:`list.sort` o la "
"funcin relacionada :func:`sorted` para ordenar (y ver :ref:`sortinghowto` "
"para ver ejemplos de uso moderadamente avanzados)."

#: ../Doc/faq/programming.rst:1109
msgid ""
"Abstractions tend to create indirections and force the interpreter to work "
"more.  If the levels of indirection outweigh the amount of useful work done, "
"your program will be slower.  You should avoid excessive abstraction, "
"especially under the form of tiny functions or methods (which are also often "
"detrimental to readability)."
msgstr ""
"Las abstracciones tienden a crear rodeos y fuerzan al intrprete a trabajar "
"ms.  Si el nivel de rodeos sobrepasa el trabajo til realizado tu programa "
"podra ser ms lento.  Deberas evitar abstracciones excesivas, "
"especialmente, en forma de pequeas funciones o mtodos (que tambin va en "
"detrimento de la legibilidad)."

#: ../Doc/faq/programming.rst:1115
#, fuzzy
msgid ""
"If you have reached the limit of what pure Python can allow, there are tools "
"to take you further away.  For example, `Cython `_ can "
"compile a slightly modified version of Python code into a C extension, and "
"can be used on many different platforms.  Cython can take advantage of "
"compilation (and optional type annotations) to make your code significantly "
"faster than when interpreted.  If you are confident in your C programming "
"skills, you can also :ref:`write a C extension module ` "
"yourself."
msgstr ""
"Si has alcanzado el lmite  de lo que permite el uso de Python puro, existen "
"otras herramientas que te permiten ir ms all.  Por ejemplo, `Cython "
"`_ puede compilar una versin ligeramente modificada del "
"cdigo Python en una extensin en C y se podra usar en muchas plataformas "
"diferentes.  Cython puede obtener ventaja de la compilacin (y anotaciones "
"de tipos opcionales) para hacer que tu cdigo sea significativamente ms "
"rpido cuando se ejecuta.  Si confas en tus habilidades de programar en C "
"tambin puedes escribir :ref:`un mdulo de extensin en C ` "
"t mismo."

#: ../Doc/faq/programming.rst:1125
msgid ""
"The wiki page devoted to `performance tips `_."
msgstr ""
"La pgina de la wiki dedicada a `trucos de rendimiento `_."

#: ../Doc/faq/programming.rst:1131
msgid "What is the most efficient way to concatenate many strings together?"
msgstr ""
"Cul es la forma ms eficiente de concatenar muchas cadenas conjuntamente?"

#: ../Doc/faq/programming.rst:1133
msgid ""
":class:`str` and :class:`bytes` objects are immutable, therefore "
"concatenating many strings together is inefficient as each concatenation "
"creates a new object.  In the general case, the total runtime cost is "
"quadratic in the total string length."
msgstr ""
"Los objetos :class:`str` y :class:`bytes` son inmutables, por tanto, "
"concatenar muchas cadenas en una sola es ineficiente debido a que cada "
"concatenacin crea un nuevo objeto. En el caso ms general, el coste total "
"en tiempo de ejecucin es cuadrtico en relacin a la longitud de la cadena "
"final."

#: ../Doc/faq/programming.rst:1138
msgid ""
"To accumulate many :class:`str` objects, the recommended idiom is to place "
"them into a list and call :meth:`str.join` at the end::"
msgstr ""
"Para acumular muchos objetos :class:`str`, la forma recomendada sera "
"colocarlos en una lista y llamar al mtodo :meth:`str.join` al final::"

#: ../Doc/faq/programming.rst:1146
msgid "(another reasonably efficient idiom is to use :class:`io.StringIO`)"
msgstr ""
"(otra forma que sera razonable en trminos de eficiencia sera usar :class:"
"`io.StringIO`)"

#: ../Doc/faq/programming.rst:1148
msgid ""
"To accumulate many :class:`bytes` objects, the recommended idiom is to "
"extend a :class:`bytearray` object using in-place concatenation (the ``+=`` "
"operator)::"
msgstr ""
"Para acumular muchos objetos :class:`bytes`, la forma recomendada sera "
"extender un objeto :class:`bytearray` usando el operador de concatenacin   "
"in situ (el operador ``+=``)::"

#: ../Doc/faq/programming.rst:1157
msgid "Sequences (Tuples/Lists)"
msgstr "Secuencias (Tuplas/Listas)"

#: ../Doc/faq/programming.rst:1160
msgid "How do I convert between tuples and lists?"
msgstr "Cmo convertir entre tuplas y listas?"

#: ../Doc/faq/programming.rst:1162
msgid ""
"The type constructor ``tuple(seq)`` converts any sequence (actually, any "
"iterable) into a tuple with the same items in the same order."
msgstr ""
"El constructor ``tuple(seq)`` convierte cualquier secuencia (en realidad, "
"cualquier iterable) en una tupla con los mismos elementos y en el mismo "
"orden."

#: ../Doc/faq/programming.rst:1165
msgid ""
"For example, ``tuple([1, 2, 3])`` yields ``(1, 2, 3)`` and ``tuple('abc')`` "
"yields ``('a', 'b', 'c')``.  If the argument is a tuple, it does not make a "
"copy but returns the same object, so it is cheap to call :func:`tuple` when "
"you aren't sure that an object is already a tuple."
msgstr ""
"Por ejemplo, ``tuple([1, 2, 3])`` lo convierte en ``(1, 2, 3)`` y "
"``tuple('abc')`` lo convierte en ``('a', 'b', 'c')``.  Si el argumento es "
"una tupla no crear una nueva copia y retornar el mismo objeto, por tanto, "
"llamar a :func:`tuple` no tendr mucho coste si no ests seguro si un objeto "
"ya es una tupla."

#: ../Doc/faq/programming.rst:1170
msgid ""
"The type constructor ``list(seq)`` converts any sequence or iterable into a "
"list with the same items in the same order.  For example, ``list((1, 2, "
"3))`` yields ``[1, 2, 3]`` and ``list('abc')`` yields ``['a', 'b', 'c']``.  "
"If the argument is a list, it makes a copy just like ``seq[:]`` would."
msgstr ""
"El constructor ``list(seq)`` convierte cualquier secuencia o iterable en una "
"lista con los mismos elementos y en el mismo orden.  Por ejemplo, ``list((1, "
"2, 3))`` lo convierte a ``[1, 2, 3]`` y ``list('abc')`` lo convierte a "
"``['a', 'b', 'c']``.  Si el argumento es una lista, har una copia como lo "
"hara ``seq[:]``."

#: ../Doc/faq/programming.rst:1177
msgid "What's a negative index?"
msgstr "Qu es un ndice negativo?"

#: ../Doc/faq/programming.rst:1179
msgid ""
"Python sequences are indexed with positive numbers and negative numbers.  "
"For positive numbers 0 is the first index 1 is the second index and so "
"forth.  For negative indices -1 is the last index and -2 is the penultimate "
"(next to last) index and so forth.  Think of ``seq[-n]`` as the same as "
"``seq[len(seq)-n]``."
msgstr ""
"Las secuencias en Python estn indexadas con nmeros positivos y negativos.  "
"Para los nmeros positivos el  0 ser el primer ndice, el 1 el segundo y "
"as en adelante.  Para los ndices negativos el -1 el ltimo ndice, el -2 "
"el penltimo, etc.  Piensa en ``seq[-n]`` como si fuera ``seq[len(seq)-n]``."

#: ../Doc/faq/programming.rst:1184
msgid ""
"Using negative indices can be very convenient.  For example ``S[:-1]`` is "
"all of the string except for its last character, which is useful for "
"removing the trailing newline from a string."
msgstr ""
"El uso de ndices negativos puede ser muy conveniente.  Por ejemplo "
"``S[:-1]`` se usa para todo la cadena excepto para su ltimo carcter, lo "
"cual es til para eliminar el salto de lnea final de una cadena."

#: ../Doc/faq/programming.rst:1190
msgid "How do I iterate over a sequence in reverse order?"
msgstr "Cmo puedo iterar sobre una secuencia en orden inverso?"

#: ../Doc/faq/programming.rst:1192
msgid "Use the :func:`reversed` built-in function::"
msgstr "Usa la funcin incorporada :func:`reversed`::"

#: ../Doc/faq/programming.rst:1197
msgid ""
"This won't touch your original sequence, but build a new copy with reversed "
"order to iterate over."
msgstr ""
"Esto no transformar la secuencia original sino que crear una nueva copia "
"en orden inverso por la que se puede iterar."

#: ../Doc/faq/programming.rst:1202
msgid "How do you remove duplicates from a list?"
msgstr "Cmo eliminar duplicados de una lista?"

#: ../Doc/faq/programming.rst:1204
msgid "See the Python Cookbook for a long discussion of many ways to do this:"
msgstr ""
"Puedes echar un vistazo al recetario de Python para ver una gran discusin "
"mostrando muchas formas de hacer esto:"

#: ../Doc/faq/programming.rst:1206
msgid "https://code.activestate.com/recipes/52560/"
msgstr "https://code.activestate.com/recipes/52560/"

#: ../Doc/faq/programming.rst:1208
msgid ""
"If you don't mind reordering the list, sort it and then scan from the end of "
"the list, deleting duplicates as you go::"
msgstr ""
"Si no te preocupa que la lista se reordene la puedes ordenar y, despus, y "
"despus escanearla desde el final borrando duplicados a medida que avanzas::"

#: ../Doc/faq/programming.rst:1220
msgid ""
"If all elements of the list may be used as set keys (i.e. they are all :term:"
"`hashable`) this is often faster ::"
msgstr ""
"Si todos los elementos de la lista pueden ser usados como claves (por "
"ejemplo son todos :term:`hashable`) esto ser, en general, ms rpido ::"

#: ../Doc/faq/programming.rst:1225
msgid ""
"This converts the list into a set, thereby removing duplicates, and then "
"back into a list."
msgstr ""
"Esto convierte la lista en un conjunto eliminando, por tanto, los duplicados "
"y, posteriormente, puedes volver a una lista."

#: ../Doc/faq/programming.rst:1230
msgid "How do you remove multiple items from a list"
msgstr "Cmo eliminar duplicados de una lista"

#: ../Doc/faq/programming.rst:1232
msgid ""
"As with removing duplicates, explicitly iterating in reverse with a delete "
"condition is one possibility.  However, it is easier and faster to use slice "
"replacement with an implicit or explicit forward iteration. Here are three "
"variations.::"
msgstr ""
"Al igual que con la eliminacin de duplicados, una posibilidad es iterar "
"explcitamente a la inversa con una condicin de eliminacin. Sin embargo, "
"es ms fcil y rpido utilizar el reemplazo de sectores con una iteracin "
"directa implcita o explcita. Aqu hay tres variaciones.::"

#: ../Doc/faq/programming.rst:1241
msgid "The list comprehension may be fastest."
msgstr "Esta comprensin de lista puede ser la ms rpida."

#: ../Doc/faq/programming.rst:1245
msgid "How do you make an array in Python?"
msgstr "Cmo se puede hacer un array en Python?"

#: ../Doc/faq/programming.rst:1247
msgid "Use a list::"
msgstr "Usa una lista::"

#: ../Doc/faq/programming.rst:1251
msgid ""
"Lists are equivalent to C or Pascal arrays in their time complexity; the "
"primary difference is that a Python list can contain objects of many "
"different types."
msgstr ""
"Las listas son equivalentes en complejidad temporal a arrays en C o Pascal; "
"La principal diferencia es que una lista en Python puede contener objetos de "
"diferentes tipos."

#: ../Doc/faq/programming.rst:1254
#, fuzzy
msgid ""
"The ``array`` module also provides methods for creating arrays of fixed "
"types with compact representations, but they are slower to index than "
"lists.  Also note that `NumPy `_ and other third party "
"packages define array-like structures with various characteristics as well."
msgstr ""
"El mdulo ``array`` proporciona, tambin, mtodos para crear arrays de tipo "
"fijo con representaciones compactas pero son ms lentos de indexar que las "
"listas.  Adems, debes tener en cuenta que las extensiones Numpy y otras "
"definen estructuras de tipo array con diversas caractersticas tambin."

#: ../Doc/faq/programming.rst:1260
#, fuzzy
msgid ""
"To get Lisp-style linked lists, you can emulate *cons cells* using tuples::"
msgstr ""
"Para obtener listas enlazadas al estilo de las de Lisp, puedes emular celdas "
"cons usando tuplas::"

#: ../Doc/faq/programming.rst:1264
#, fuzzy
msgid ""
"If mutability is desired, you could use lists instead of tuples.  Here the "
"analogue of a Lisp *car* is ``lisp_list[0]`` and the analogue of *cdr* is "
"``lisp_list[1]``.  Only do this if you're sure you really need to, because "
"it's usually a lot slower than using Python lists."
msgstr ""
"Si deseas que haya mutabilidad podras usar listas en lugar de tuplas.  El "
"anlogo a un car de Lisp es ``lisp_list[0]`` y al anlogo a cdr es "
"``lisp_list[1]``.  Haz esto solo si ests seguro que es lo que necesitas "
"debido a que, normalmente, ser bastante ms lento que el usar listas  "
"Python."

#: ../Doc/faq/programming.rst:1273
msgid "How do I create a multidimensional list?"
msgstr "Cmo puedo crear una lista multidimensional?"

#: ../Doc/faq/programming.rst:1275
msgid "You probably tried to make a multidimensional array like this::"
msgstr ""
"Seguramente hayas intentado crear un array multidimensional de la siguiente "
"forma::"

#: ../Doc/faq/programming.rst:1279
msgid "This looks correct if you print it:"
msgstr "Esto parece correcto si lo muestras en pantalla:"

#: ../Doc/faq/programming.rst:1290
msgid "But when you assign a value, it shows up in multiple places:"
msgstr "Pero cuando asignas un valor, se muestra en mltiples sitios:"

#: ../Doc/faq/programming.rst:1302
msgid ""
"The reason is that replicating a list with ``*`` doesn't create copies, it "
"only creates references to the existing objects.  The ``*3`` creates a list "
"containing 3 references to the same list of length two.  Changes to one row "
"will show in all rows, which is almost certainly not what you want."
msgstr ""
"La razn es que replicar una lista con ``*`` no crea copias, solo crea "
"referencias a los objetos existentes.  El ``*3`` crea una lista conteniendo "
"3 referencias a la misma lista de longitud dos.  Cambios a una fila se "
"mostrarn en todas las filas, lo cual, seguramente, no es lo que deseas."

#: ../Doc/faq/programming.rst:1307
msgid ""
"The suggested approach is to create a list of the desired length first and "
"then fill in each element with a newly created list::"
msgstr ""
"El enfoque recomendado sera crear, primero, una lista de la longitud "
"deseada y, despus, rellenar cada elemento con una lista creada en ese "
"momento::"

#: ../Doc/faq/programming.rst:1314
msgid ""
"This generates a list containing 3 different lists of length two.  You can "
"also use a list comprehension::"
msgstr ""
"Esto genera una lista conteniendo 3 listas distintas de longitud dos.  "
"Tambin puedes usar una comprensin de lista::"

#: ../Doc/faq/programming.rst:1320
#, fuzzy
msgid ""
"Or, you can use an extension that provides a matrix datatype; `NumPy "
"`_ is the best known."
msgstr ""
"O puedes usar una extensin que proporcione un tipo de dato para matrices; "
"`NumPy `_ es la ms conocida."

#: ../Doc/faq/programming.rst:1325
#, fuzzy
msgid "How do I apply a method or function to a sequence of objects?"
msgstr "Cmo puedo aplicar un mtodo a una secuencia de objetos?"

#: ../Doc/faq/programming.rst:1327
msgid ""
"To call a method or function and accumulate the return values is a list, a :"
"term:`list comprehension` is an elegant solution::"
msgstr ""

#: ../Doc/faq/programming.rst:1334
msgid ""
"To just run the method or function without saving the return values, a "
"plain :keyword:`for` loop will suffice::"
msgstr ""

#: ../Doc/faq/programming.rst:1346
msgid ""
"Why does a_tuple[i] += ['item'] raise an exception when the addition works?"
msgstr ""
"Por qu hacer lo siguiente, ``a_tuple[i] += ['item']``, lanza una excepcin "
"cuando la suma funciona?"

#: ../Doc/faq/programming.rst:1348
msgid ""
"This is because of a combination of the fact that augmented assignment "
"operators are *assignment* operators, and the difference between mutable and "
"immutable objects in Python."
msgstr ""
"Esto es debido a la combinacin del hecho de que un operador de asignacin "
"aumentada es un operador de *asignacin* y a la diferencia entre objetos "
"mutables e inmutable en Python."

#: ../Doc/faq/programming.rst:1352
msgid ""
"This discussion applies in general when augmented assignment operators are "
"applied to elements of a tuple that point to mutable objects, but we'll use "
"a ``list`` and ``+=`` as our exemplar."
msgstr ""
"Esta discusin aplica, en general, cuando los operadores de asignacin "
"aumentada se aplican a elementos de una tupla que apuntan a objetos "
"mutables. Pero vamos a usar una ``lista`` y ``+=`` para el ejemplo."

#: ../Doc/faq/programming.rst:1356
msgid "If you wrote::"
msgstr "Si escribes::"

#: ../Doc/faq/programming.rst:1364
msgid ""
"The reason for the exception should be immediately clear: ``1`` is added to "
"the object ``a_tuple[0]`` points to (``1``), producing the result object, "
"``2``, but when we attempt to assign the result of the computation, ``2``, "
"to element ``0`` of the tuple, we get an error because we can't change what "
"an element of a tuple points to."
msgstr ""
"La razn por la que se produce la excepcin debera ser evidente: ``1`` se "
"aade al objeto ``a_tuple[0]`` que apunta a (``1``), creando el objeto "
"resultante, ``2``, pero cuando intentamos asignar el resultado del clculo, "
"``2``, al elemento ``0`` de la tupla, obtenemos un error debido a que no "
"podemos cambiar el elemento al que apunta la tupla."

#: ../Doc/faq/programming.rst:1370
msgid ""
"Under the covers, what this augmented assignment statement is doing is "
"approximately this::"
msgstr ""
"En realidad, lo que esta declaracin de asignacin aumentada est haciendo "
"es, aproximadamente, lo siguiente::"

#: ../Doc/faq/programming.rst:1379
msgid ""
"It is the assignment part of the operation that produces the error, since a "
"tuple is immutable."
msgstr ""
"Es la parte de asignacin de la operacin la que provoca el error, debido a "
"que una tupla es inmutable."

#: ../Doc/faq/programming.rst:1382
msgid "When you write something like::"
msgstr "Cuando escribes algo como lo siguiente::"

#: ../Doc/faq/programming.rst:1390
msgid ""
"The exception is a bit more surprising, and even more surprising is the fact "
"that even though there was an error, the append worked::"
msgstr ""
"La excepcin es un poco ms sorprendente e, incluso, ms sorprendente es el "
"hecho que aunque hubo un error, la agregacin funcion::"

#: ../Doc/faq/programming.rst:1396
#, fuzzy
msgid ""
"To see why this happens, you need to know that (a) if an object implements "
"an :meth:`~object.__iadd__` magic method, it gets called when the ``+=`` "
"augmented assignment is executed, and its return value is what gets used in "
"the assignment statement; and (b) for lists, :meth:`!__iadd__` is equivalent "
"to calling :meth:`!extend` on the list and returning the list.  That's why "
"we say that for lists, ``+=`` is a \"shorthand\" for :meth:`!list.extend`::"
msgstr ""
"Para ver lo que sucede necesitas saber que (a) si un objeto implementa un "
"mtodo mgico ``__iadd__`` , se le llama cuando se ejecuta la asignacin "
"aumentada ``+=`` y el valor devuelto es lo que se usa en la declaracin de "
"asignacin; y (b) para listas, ``__iadd__`` es equivalente a llamar a "
"``extend`` en la lista y retornar la lista.  Es por esto que decimos que "
"para listas, ``+=`` es un atajo para ``list.extend``::"

#: ../Doc/faq/programming.rst:1409
msgid "This is equivalent to::"
msgstr "Esto es equivalente a ::"

#: ../Doc/faq/programming.rst:1414
msgid ""
"The object pointed to by a_list has been mutated, and the pointer to the "
"mutated object is assigned back to ``a_list``.  The end result of the "
"assignment is a no-op, since it is a pointer to the same object that "
"``a_list`` was previously pointing to, but the assignment still happens."
msgstr ""
"El objeto al que apunta a_list ha mutado y el puntero al objeto mutado es "
"asignado de vuelta a ``a_list``.  El resultado final de la asignacin no es "
"opcin debido a que es un puntero al mismo objeto al que estaba apuntando "
"``a_list``  pero la asignacin s que ocurre."

#: ../Doc/faq/programming.rst:1419
msgid "Thus, in our tuple example what is happening is equivalent to::"
msgstr ""
"Por tanto, en nuestro ejemplo con tupla lo que est pasando es equivalente "
"a::"

#: ../Doc/faq/programming.rst:1427
#, fuzzy
msgid ""
"The :meth:`!__iadd__` succeeds, and thus the list is extended, but even "
"though ``result`` points to the same object that ``a_tuple[0]`` already "
"points to, that final assignment still results in an error, because tuples "
"are immutable."
msgstr ""
"El ``__iadd__`` se realiza con xito y la lista se extiende pero, incluso "
"aunque ``result`` apunta al mismo objeto al que ya est apuntando "
"``a_tuple[0]`` la asignacin final sigue resultando en un error, debido a "
"que las tuplas son inmutables."

#: ../Doc/faq/programming.rst:1433
msgid ""
"I want to do a complicated sort: can you do a Schwartzian Transform in "
"Python?"
msgstr ""
"Quiero hacer una ordenacin compleja: Puedes hacer una transformada "
"Schwartziana (Schwartzian Transform) en Python?"

#: ../Doc/faq/programming.rst:1435
msgid ""
"The technique, attributed to Randal Schwartz of the Perl community, sorts "
"the elements of a list by a metric which maps each element to its \"sort "
"value\". In Python, use the ``key`` argument for the :meth:`list.sort` "
"method::"
msgstr ""
"La tcnica, atribuida a Randal Schwartz, miembro de la comunidad Perl, "
"ordena los elementos de una lista mediante una mtrica que mapea cada "
"elemento a su \"valor orden\". En Python, usa el argumento ``key`` par el "
"mtodo :meth:`list.sort`::"

#: ../Doc/faq/programming.rst:1444
msgid "How can I sort one list by values from another list?"
msgstr "Cmo puedo ordenar una lista a partir de valores de otra lista?"

#: ../Doc/faq/programming.rst:1446
msgid ""
"Merge them into an iterator of tuples, sort the resulting list, and then "
"pick out the element you want. ::"
msgstr ""
"Las puedes unir en un iterador de tuplas, ordena la lista resultando y "
"despus extrae el elemento que deseas. ::"

#: ../Doc/faq/programming.rst:1461
msgid "Objects"
msgstr "Objetos"

#: ../Doc/faq/programming.rst:1464
msgid "What is a class?"
msgstr "Qu es una clase?"

#: ../Doc/faq/programming.rst:1466
msgid ""
"A class is the particular object type created by executing a class "
"statement. Class objects are used as templates to create instance objects, "
"which embody both the data (attributes) and code (methods) specific to a "
"datatype."
msgstr ""
"Una clase es un tipo de objeto particular creado mediante la ejecucin de la "
"declaracin class. Los objetos class se usan como plantillas para crear "
"instancias de objetos que son tanto los datos (atributos) como el cdigo "
"(mtodos) especficos para un tipo de dato."

#: ../Doc/faq/programming.rst:1470
msgid ""
"A class can be based on one or more other classes, called its base "
"class(es). It then inherits the attributes and methods of its base classes. "
"This allows an object model to be successively refined by inheritance.  You "
"might have a generic ``Mailbox`` class that provides basic accessor methods "
"for a mailbox, and subclasses such as ``MboxMailbox``, ``MaildirMailbox``, "
"``OutlookMailbox`` that handle various specific mailbox formats."
msgstr ""
"Una clase puede estar basada en una o ms clases diferentes, llamadas su(s) "
"clase(s). Hereda los atributos y mtodos de sus clases base. Esto permite "
"que se pueda refinar un objeto modelo de forma sucesiva mediante herencia.  "
"Puedes tener una clase genrica ``Mailbox``  que proporciona mtodos de "
"acceso bsico para un buzn de correo y subclases como ``MboxMailbox``, "
"``MaildirMailbox``, ``OutlookMailbox`` que gestionan distintos formatos "
"especficos de buzn de correos."

#: ../Doc/faq/programming.rst:1479
msgid "What is a method?"
msgstr "Qu es un mtodo?"

#: ../Doc/faq/programming.rst:1481
msgid ""
"A method is a function on some object ``x`` that you normally call as ``x."
"name(arguments...)``.  Methods are defined as functions inside the class "
"definition::"
msgstr ""
"Un mtodo es una funcin de un objeto ``x`` que puedes llamar, normalmente, "
"de la forma ``x.name(arguments...)``.  Los mtodos  se definen como "
"funciones dentro de la definicin de la clase::"

#: ../Doc/faq/programming.rst:1491
msgid "What is self?"
msgstr "Qu es self?"

#: ../Doc/faq/programming.rst:1493
msgid ""
"Self is merely a conventional name for the first argument of a method.  A "
"method defined as ``meth(self, a, b, c)`` should be called as ``x.meth(a, b, "
"c)`` for some instance ``x`` of the class in which the definition occurs; "
"the called method will think it is called as ``meth(x, a, b, c)``."
msgstr ""
"Self es, bsicamente, un nombre que se usa de forma convencional como primer "
"argumento de un mtodo.  Un mtodo definido como ``meth(self, a, b, c)`` se "
"le llama como ``x.meth(a, b, c)`` para una instancia ``x`` de la clase es "
"que se defini; el mtodo invocado pensar que se le ha invocado como "
"``meth(x, a, b, c)``."

#: ../Doc/faq/programming.rst:1498
msgid "See also :ref:`why-self`."
msgstr "Ver tambin :ref:`why-self`."

#: ../Doc/faq/programming.rst:1502
msgid ""
"How do I check if an object is an instance of a given class or of a subclass "
"of it?"
msgstr ""
"Cmo puedo comprobar si un objeto es una instancia de una clase dada o de "
"una subclase de la misma?"

#: ../Doc/faq/programming.rst:1504
#, fuzzy
msgid ""
"Use the built-in function :func:`isinstance(obj, cls) `.  You "
"can check if an object is an instance of any of a number of classes by "
"providing a tuple instead of a single class, e.g. ``isinstance(obj, (class1, "
"class2, ...))``, and can also check whether an object is one of Python's "
"built-in types, e.g. ``isinstance(obj, str)`` or ``isinstance(obj, (int, "
"float, complex))``."
msgstr ""
"Usa la funcin incorporada ``isinstance(obj, cls)``.  Puedes comprobar si un "
"objeto es una instancia de cualquier nmero de clases proporcionando una "
"tupla en lugar de una sola clase, por ejemplo ``isinstance(obj, (class1, "
"class2, ...))`` y, tambin, puedes comprobar si un objeto es uno de los "
"tipos incorporados por ejemplo ``isinstance(obj, str)`` o ``isinstance(obj, "
"(int, float, complex))``."

#: ../Doc/faq/programming.rst:1511
msgid ""
"Note that :func:`isinstance` also checks for virtual inheritance from an :"
"term:`abstract base class`.  So, the test will return ``True`` for a "
"registered class even if hasn't directly or indirectly inherited from it.  "
"To test for \"true inheritance\", scan the :term:`MRO` of the class:"
msgstr ""
"Note que :func:`isinstance` tambin verifica la herencia virtual de una :"
"term:`abstract base class`. Entonces, la prueba retorna `True` para una "
"clase registrada incluso si no ha heredado directa o indirectamente de ella. "
"Para verificar \"herencia verdadera\", escanea el :term:`MRO` de la clase:"

#: ../Doc/faq/programming.rst:1546
msgid ""
"Note that most programs do not use :func:`isinstance` on user-defined "
"classes very often.  If you are developing the classes yourself, a more "
"proper object-oriented style is to define methods on the classes that "
"encapsulate a particular behaviour, instead of checking the object's class "
"and doing a different thing based on what class it is.  For example, if you "
"have a function that does something::"
msgstr ""
"Destacar que muchos programas no necesitan usar :func:`isinstance` de forma "
"frecuente en clases definidas por el usuario.  Si ests desarrollando clases "
"un mejor estilo orientado a objetos sera el de definir los mtodos en las "
"clases que encapsulan un comportamiento en particular en lugar de ir "
"comprobando la clase del objeto e ir haciendo cosas en base a la clase que "
"es.  Por ejemplo, si tienes una funcin que hace lo siguiente::"

#: ../Doc/faq/programming.rst:1560
msgid ""
"A better approach is to define a ``search()`` method on all the classes and "
"just call it::"
msgstr ""
"Un enfoque ms adecuado sera definir un mtodo ``search()`` en todas las "
"clases e invocarlo::"

#: ../Doc/faq/programming.rst:1575
msgid "What is delegation?"
msgstr "Qu es la delegacin?"

#: ../Doc/faq/programming.rst:1577
msgid ""
"Delegation is an object oriented technique (also called a design pattern). "
"Let's say you have an object ``x`` and want to change the behaviour of just "
"one of its methods.  You can create a new class that provides a new "
"implementation of the method you're interested in changing and delegates all "
"other methods to the corresponding method of ``x``."
msgstr ""
"La delegacin es una tcnica orientada a objetos (tambin llamado un patrn "
"de diseo). Digamos que tienes un objeto ``x`` y deseas cambiar el "
"comportamiento de solo uno de sus mtodos.  Puedes crear una nueva clase que "
"proporciona una nueva implementacin del mtodo que te interesa cambiar y "
"delega el resto de mtodos al mtodo correspondiente de ``x``."

#: ../Doc/faq/programming.rst:1583
msgid ""
"Python programmers can easily implement delegation.  For example, the "
"following class implements a class that behaves like a file but converts all "
"written data to uppercase::"
msgstr ""
"Los programadores Python pueden implementar la delegacin de forma muy "
"sencilla.  Por ejemplo, la siguiente clase implementa una clase que se "
"comporta como un fichero pero convierte todos los datos escritos a "
"maysculas::"

#: ../Doc/faq/programming.rst:1598
#, fuzzy
msgid ""
"Here the ``UpperOut`` class redefines the ``write()`` method to convert the "
"argument string to uppercase before calling the underlying ``self._outfile."
"write()`` method.  All other methods are delegated to the underlying ``self."
"_outfile`` object.  The delegation is accomplished via the :meth:`~object."
"__getattr__` method; consult :ref:`the language reference ` for more information about controlling attribute access."
msgstr ""
"Aqu, la clase ``UpperOut``  redefine el mtodo ``write()`` para convertir "
"la cadena del argumento a mayscula antes de invocar al mtodo ``self."
"_outfile.write()``.  El resto de mtodos han sido delegados al objeto ``self."
"_outfile``.  La delegacin se consigue mediante el mtodo ``__getattr__``; "
"consulta :ref:`la referencia del lenguaje ` para obtener "
"ms informacin sobre cmo controlar el acceso a atributos."

#: ../Doc/faq/programming.rst:1605
#, fuzzy
msgid ""
"Note that for more general cases delegation can get trickier. When "
"attributes must be set as well as retrieved, the class must define a :meth:"
"`~object.__setattr__` method too, and it must do so carefully.  The basic "
"implementation of :meth:`!__setattr__` is roughly equivalent to the "
"following::"
msgstr ""
"Ten en cuenta que para casos ms generales la delegacin puede ser algo ms "
"complicada. Cuando los atributos se deben colocar y recuperar la clase debe "
"definir, tambin, un mtodo :meth:`__setattr__`  y hay que hacerlo con "
"cuidado.  La implementacin bsica de :meth:`__setattr__` es, "
"aproximadamente, equivalente a lo siguiente::"

#: ../Doc/faq/programming.rst:1616
#, fuzzy
msgid ""
"Most :meth:`!__setattr__` implementations must modify :meth:`self.__dict__ "
"` to store local state for self without causing an infinite "
"recursion."
msgstr ""
"Muchas implementaciones de :meth:`__setattr__` deben modificar ``self."
"__dict__`` para almacenar el estado local para self sin provocar una "
"recursin infinita."

#: ../Doc/faq/programming.rst:1622
msgid ""
"How do I call a method defined in a base class from a derived class that "
"extends it?"
msgstr ""
"Cmo invoco a un mtodo definido en una clase base desde una clase derivada "
"que la extiende?"

#: ../Doc/faq/programming.rst:1624
msgid "Use the built-in :func:`super` function::"
msgstr "Usa la funcin incorporada :func:`super`::"

#: ../Doc/faq/programming.rst:1630
msgid ""
"In the example, :func:`super` will automatically determine the instance from "
"which it was called (the ``self`` value), look up the :term:`method "
"resolution order` (MRO) with ``type(self).__mro__``, and return the next in "
"line after ``Derived`` in the MRO: ``Base``."
msgstr ""
"En el ejemplo, :func:`super` automticamente determinar la instancia desde "
"la cual ha sido llamada (el valor ``self```), busca el :term:`method "
"resolution order` (MRO) con ``type(self).__mro__``, y devuelve el siguiente "
"en lnea despus de ``Derived`` en el MRO: ``Base``."

#: ../Doc/faq/programming.rst:1637
msgid "How can I organize my code to make it easier to change the base class?"
msgstr ""
"Cmo puedo organizar mi cdigo para hacer que sea ms sencillo modificar la "
"clase base?"

#: ../Doc/faq/programming.rst:1639
msgid ""
"You could assign the base class to an alias and derive from the alias.  Then "
"all you have to change is the value assigned to the alias.  Incidentally, "
"this trick is also handy if you want to decide dynamically (e.g. depending "
"on availability of resources) which base class to use.  Example::"
msgstr ""
"Puede asignar la clase base a un alias y derivar del alias. Entonces todo lo "
"que tiene que cambiar es el valor asignado al alias. Por cierto, este truco "
"tambin es til si desea decidir dinmicamente (por ejemplo, dependiendo de "
"la disponibilidad de recursos) qu clase base usar. Ejemplo::"

#: ../Doc/faq/programming.rst:1654
msgid "How do I create static class data and static class methods?"
msgstr ""
"Cmo puedo crear datos estticos de clase y mtodos estticos de clase?"

#: ../Doc/faq/programming.rst:1656
msgid ""
"Both static data and static methods (in the sense of C++ or Java) are "
"supported in Python."
msgstr ""
"Tanto los datos estticos como los mtodos estticos (en el sentido de C++ o "
"Java) estn permitidos en Python."

#: ../Doc/faq/programming.rst:1659
msgid ""
"For static data, simply define a class attribute.  To assign a new value to "
"the attribute, you have to explicitly use the class name in the assignment::"
msgstr ""
"Para datos estticos simplemente define un atributo de clase.  Para asignar "
"un nuevo valor al atributo debes usar de forma explcita el nombre de la "
"clase en la asignacin::"

#: ../Doc/faq/programming.rst:1671
msgid ""
"``c.count`` also refers to ``C.count`` for any ``c`` such that "
"``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some "
"class on the base-class search path from ``c.__class__`` back to ``C``."
msgstr ""
"``c.count`` tambin se refiere a ``C.count`` para cualquier ``c`` de tal "
"forma que se cumpla ``isinstance(c, C)``, a no ser que ``c`` sea "
"sobreescrita por si misma o por alguna clase contenida en la bsqueda de "
"clases base desde ``c.__class__`` hasta ``C``."

#: ../Doc/faq/programming.rst:1675
msgid ""
"Caution: within a method of C, an assignment like ``self.count = 42`` "
"creates a new and unrelated instance named \"count\" in ``self``'s own "
"dict.  Rebinding of a class-static data name must always specify the class "
"whether inside a method or not::"
msgstr ""
"Debes tener cuidado: dentro de un mtodo de C, una asignacin como ``self."
"count = 42`` crear una nueva instancia sin relacin con la original que se "
"llamar \"count\" en el propio diccionario de ``self``.  El reunificar el "
"nombre de datos estticos de una clase debera llevar, siempre, a "
"especificar la clase tanto si se produce desde dentro de un mtodo como si "
"no::"

#: ../Doc/faq/programming.rst:1682
msgid "Static methods are possible::"
msgstr "Los mtodos estticos son posibles::"

#: ../Doc/faq/programming.rst:1690
msgid ""
"However, a far more straightforward way to get the effect of a static method "
"is via a simple module-level function::"
msgstr ""
"Sin embargo, una forma ms directa de obtener el efecto de un mtodo "
"esttico sera mediante una simple funcin a nivel de mdulo::"

#: ../Doc/faq/programming.rst:1696
msgid ""
"If your code is structured so as to define one class (or tightly related "
"class hierarchy) per module, this supplies the desired encapsulation."
msgstr ""
"Si has estructurado tu cdigo para definir una clase nica (o una jerarqua "
"de clases altamente relacionadas) por mdulo, esto proporcionar la "
"encapsulacin deseada."

#: ../Doc/faq/programming.rst:1701
msgid "How can I overload constructors (or methods) in Python?"
msgstr "Como puedo sobrecargar constructores (o mtodos) en Python?"

#: ../Doc/faq/programming.rst:1703
msgid ""
"This answer actually applies to all methods, but the question usually comes "
"up first in the context of constructors."
msgstr ""
"Esta respuesta es aplicable, en realidad, a todos los mtodos pero la "
"pregunta suele surgir primero en el contexto de los constructores."

#: ../Doc/faq/programming.rst:1706
msgid "In C++ you'd write"
msgstr "En C++ deberas escribir"

#: ../Doc/faq/programming.rst:1715
msgid ""
"In Python you have to write a single constructor that catches all cases "
"using default arguments.  For example::"
msgstr ""
"En Python solo debes escribir un nico constructor que tenga en cuenta todos "
"los casos usando los argumentos por defecto.  Por ejemplo::"

#: ../Doc/faq/programming.rst:1725
msgid "This is not entirely equivalent, but close enough in practice."
msgstr ""
"Esto no es totalmente equivalente pero, en la prctica, es muy similar."

#: ../Doc/faq/programming.rst:1727
msgid "You could also try a variable-length argument list, e.g. ::"
msgstr ""
"Podras intentar, tambin una lista de argumentos de longitud variable, por "
"ejemplo ::"

#: ../Doc/faq/programming.rst:1732
msgid "The same approach works for all method definitions."
msgstr "El mismo enfoque funciona para todas las definiciones de mtodos."

#: ../Doc/faq/programming.rst:1736
msgid "I try to use __spam and I get an error about _SomeClassName__spam."
msgstr "Intento usar __spam y obtengo un error sobre _SomeClassName__spam."

#: ../Doc/faq/programming.rst:1738
msgid ""
"Variable names with double leading underscores are \"mangled\" to provide a "
"simple but effective way to define class private variables.  Any identifier "
"of the form ``__spam`` (at least two leading underscores, at most one "
"trailing underscore) is textually replaced with ``_classname__spam``, where "
"``classname`` is the current class name with any leading underscores "
"stripped."
msgstr ""
"Nombres de variable con doble guin prefijado se convierten, con una "
"modificacin de nombres, para proporcionar una forma simple pero efectiva de "
"definir variables de clase privadas. Cualquier identificador de la forma "
"``__spam`` (como mnimo dos guiones bajos como prefijo, como mximo un guin "
"bajo como sufijo) se reemplaza con ``_classname__spam``, donde ``classname`` "
"es el nombre de la clase eliminando cualquier guin bajo prefijado."

#: ../Doc/faq/programming.rst:1744
msgid ""
"This doesn't guarantee privacy: an outside user can still deliberately "
"access the \"_classname__spam\" attribute, and private values are visible in "
"the object's ``__dict__``.  Many Python programmers never bother to use "
"private variable names at all."
msgstr ""
"Esto no garantiza la privacidad: un usuario externo puede acceder, de forma "
"deliberada y si as lo desea, al atributo \"_classname__spam\",  y los "
"valores privados son visibles en el ``__dict__`` del objeto.  Muchos "
"programadores Python no se suelen molestar en usar nombres privados de "
"variables."

#: ../Doc/faq/programming.rst:1751
msgid "My class defines __del__ but it is not called when I delete the object."
msgstr "Mi clase define __del__ pero no se le invoca cuando borro el objeto."

#: ../Doc/faq/programming.rst:1753
msgid "There are several possible reasons for this."
msgstr "Existen varias razones posibles para que suceda as."

#: ../Doc/faq/programming.rst:1755
#, fuzzy
msgid ""
"The :keyword:`del` statement does not necessarily call :meth:`~object."
"__del__` -- it simply decrements the object's reference count, and if this "
"reaches zero :meth:`!__del__` is called."
msgstr ""
"La declaracin del no invoca, necesariamente, al mtodo :meth:`__del__` -- "
"simplemente reduce el conteo de referencias del objeto y, si se reduce a "
"cero entonces es cuando se invoca a :meth:`__del__`."

#: ../Doc/faq/programming.rst:1759
#, fuzzy
msgid ""
"If your data structures contain circular links (e.g. a tree where each child "
"has a parent reference and each parent has a list of children) the reference "
"counts will never go back to zero.  Once in a while Python runs an algorithm "
"to detect such cycles, but the garbage collector might run some time after "
"the last reference to your data structure vanishes, so your :meth:`!__del__` "
"method may be called at an inconvenient and random time. This is "
"inconvenient if you're trying to reproduce a problem. Worse, the order in "
"which object's :meth:`!__del__` methods are executed is arbitrary.  You can "
"run :func:`gc.collect` to force a collection, but there *are* pathological "
"cases where objects will never be collected."
msgstr ""
"Si tus estructuras de datos contienen enlaces circulares (por ejemplo un "
"rbol en el cual cada hijo tiene una referencia al padre y cada padre tiene "
"una lista de hijos) el conteo de referencias no alcanzar nunca el valor de "
"cero.  De vez en cuando, Python ejecuta un algoritmo para detectar esos "
"ciclos pero el recolector de basura debe ejecutarse un rato despus de que "
"se desvanezca la ltima referencia a tu estructura de datos, de tal forma "
"que tu mtodo :meth:`__del__` se pueda invocar en un momento aleatorio que "
"no resulte inconveniente. Esto no es conveniente si ests intentando "
"reproducir un problema. Peor an, el orden en el que se ejecutan los "
"mtodos :meth:`__del__` del objeto es arbitrario.  Puedes ejecutar :func:`gc."
"collect` para forzar una recoleccin pero *existen* casos patolgicos en los "
"cuales los objetos nunca sern recolectados."

#: ../Doc/faq/programming.rst:1770
#, fuzzy
msgid ""
"Despite the cycle collector, it's still a good idea to define an explicit "
"``close()`` method on objects to be called whenever you're done with them.  "
"The ``close()`` method can then remove attributes that refer to subobjects.  "
"Don't call :meth:`!__del__` directly -- :meth:`!__del__` should call "
"``close()`` and ``close()`` should make sure that it can be called more than "
"once for the same object."
msgstr ""
"A pesar del recolector de ciclos, siempre ser buena idea definir un mtodo "
"``close()`` de forma explcita en objetos que debe ser llamado en el momento "
"que has terminado con ellos.  El mtodo ``close()`` puede, en ese momento, "
"eliminar atributos que se refieren a subobjetos.  No invoques directamente "
"a :meth:`__del__` -- :meth:`__del__` debe invocar a ``close()`` y "
"``close()`` debe asegurarse que puede ser invocado ms de una vez en el "
"mismo objeto."

#: ../Doc/faq/programming.rst:1777
msgid ""
"Another way to avoid cyclical references is to use the :mod:`weakref` "
"module, which allows you to point to objects without incrementing their "
"reference count. Tree data structures, for instance, should use weak "
"references for their parent and sibling references (if they need them!)."
msgstr ""
"Otra forma de evitar referencias cclicas sera usando el mdulo :mod:"
"`weakref`, que permite apuntar hacia objetos sin incrementar su conteo de "
"referencias. Las estructuras de datos en rbol, por ejemplo, deberan usar "
"referencias dbiles para las referencias del padre y hermanos (si es que "
"las necesitan!)."

#: ../Doc/faq/programming.rst:1790
#, fuzzy
msgid ""
"Finally, if your :meth:`!__del__` method raises an exception, a warning "
"message is printed to :data:`sys.stderr`."
msgstr ""
"Finalmente, si tu mtodo :meth:`__del__` lanza una excepcin, se manda un "
"mensaje de alerta a :data:`sys.stderr`."

#: ../Doc/faq/programming.rst:1795
msgid "How do I get a list of all instances of a given class?"
msgstr ""
"Cmo puedo obtener una lista de todas las instancias de una clase dada?"

#: ../Doc/faq/programming.rst:1797
msgid ""
"Python does not keep track of all instances of a class (or of a built-in "
"type). You can program the class's constructor to keep track of all "
"instances by keeping a list of weak references to each instance."
msgstr ""
"Python no hace seguimiento de todas las instancias de una clase (o de los "
"tipos incorporados). Puedes programar el constructor de una clase para que "
"haga seguimiento de todas sus instancias manteniendo una lista de "
"referencias dbiles a cada instancia."

#: ../Doc/faq/programming.rst:1803
msgid "Why does the result of ``id()`` appear to be not unique?"
msgstr "Por qu el resultado de ``id()`` no parece ser nico?"

#: ../Doc/faq/programming.rst:1805
msgid ""
"The :func:`id` builtin returns an integer that is guaranteed to be unique "
"during the lifetime of the object.  Since in CPython, this is the object's "
"memory address, it happens frequently that after an object is deleted from "
"memory, the next freshly created object is allocated at the same position in "
"memory.  This is illustrated by this example:"
msgstr ""
"La funcin incorporada :func:`id` devuelve un entero que se garantiza que "
"sea nico durante la vida del objeto.  Debido a que en CPython esta es la "
"direccin en memoria del objeto, sucede que, frecuentemente, despus de que "
"un objeto se elimina de la memoria el siguiente objeto recin creado se "
"localiza en la misma posicin en memoria.  Esto se puede ver ilustrado en "
"este ejemplo:"

#: ../Doc/faq/programming.rst:1816
msgid ""
"The two ids belong to different integer objects that are created before, and "
"deleted immediately after execution of the ``id()`` call.  To be sure that "
"objects whose id you want to examine are still alive, create another "
"reference to the object:"
msgstr ""
"Las dos ids pertenecen a dos objetos 'entero' diferentes que se crean antes "
"y se eliminan inmediatamente despus de la ejecucin de la invocacin a "
"``id()``.  Para estar seguro que los objetos cuya id quieres examinar siguen "
"vivos crea otra referencia al objeto:"

#: ../Doc/faq/programming.rst:1829
msgid "When can I rely on identity tests with the *is* operator?"
msgstr "Cundo puedo fiarme de pruebas de identidad con el operador *is*?"

#: ../Doc/faq/programming.rst:1831
msgid ""
"The ``is`` operator tests for object identity.  The test ``a is b`` is "
"equivalent to ``id(a) == id(b)``."
msgstr ""
"El operador ``is`` verifica la identidad de un objeto. La prueba ``a is b`` "
"es equivalente a ``id(a) == id(b)``."

#: ../Doc/faq/programming.rst:1834
msgid ""
"The most important property of an identity test is that an object is always "
"identical to itself, ``a is a`` always returns ``True``.  Identity tests are "
"usually faster than equality tests.  And unlike equality tests, identity "
"tests are guaranteed to return a boolean ``True`` or ``False``."
msgstr ""
"La propiedad ms importante de una prueba de identidad es que un objeto "
"siempre es idntico a si mismo, ``a is a`` siempre devuelve ``True``.  Las "
"pruebas de identidad suelen ser ms rpidas que pruebas de igualdad.  Y a "
"diferencia de las pruebas de igualdad, las pruebas de identidad estn "
"garantizadas de devolver un booleano ``True`` o ``False``."

#: ../Doc/faq/programming.rst:1839
msgid ""
"However, identity tests can *only* be substituted for equality tests when "
"object identity is assured.  Generally, there are three circumstances where "
"identity is guaranteed:"
msgstr ""
"Sin embargo, las pruebas de identidad *solo* pueden ser sustituidas por "
"pruebas de igualdad cuando la identidad de objeto est asegurada.  "
"Generalmente hay tres circunstancias en las que la identidad est "
"garantizada:"

#: ../Doc/faq/programming.rst:1843
msgid ""
"1) Assignments create new names but do not change object identity.  After "
"the assignment ``new = old``, it is guaranteed that ``new is old``."
msgstr ""
"1) Las asignaciones crean nuevos nombres pero no cambian la identidad del "
"objeto. Luego de la asignacin ``new = old``, est garantizado que ``new is "
"old``."

#: ../Doc/faq/programming.rst:1846
msgid ""
"2) Putting an object in a container that stores object references does not "
"change object identity.  After the list assignment ``s[0] = x``, it is "
"guaranteed that ``s[0] is x``."
msgstr ""
"2) Poner un objeto en un contenedor que guarda referencias de objeto no "
"cambia la identidad del objeto.  Luego de la asignacin de lista ``s[0] = "
"x``, est garantizado que ``s[0] is x``."

#: ../Doc/faq/programming.rst:1850
msgid ""
"3) If an object is a singleton, it means that only one instance of that "
"object can exist.  After the assignments ``a = None`` and ``b = None``, it "
"is guaranteed that ``a is b`` because ``None`` is a singleton."
msgstr ""
"3) Si un objeto es un singleton, significa que solo una instancia de ese "
"objeto puede existir.  Despus de las asignaciones ``a = None`` y ``b = "
"None``, est garantizado que ``a is b`` porque ``None`` es un singleton."

#: ../Doc/faq/programming.rst:1854
msgid ""
"In most other circumstances, identity tests are inadvisable and equality "
"tests are preferred.  In particular, identity tests should not be used to "
"check constants such as :class:`int` and :class:`str` which aren't "
"guaranteed to be singletons::"
msgstr ""
"En la mayora de las dems circunstancias, no se recomiendan las pruebas de "
"identidad y las pruebas de igualdad son preferidas.  En particular, las "
"pruebas de identidad no deben ser usadas para verificar constantes como :"
"class:`int` y :class:`str` que no estn garantizadas a ser singletons::"

#: ../Doc/faq/programming.rst:1871
msgid "Likewise, new instances of mutable containers are never identical::"
msgstr ""
"De la misma manera, nuevas instancias de contenedores mutables nunca son "
"idnticas::"

#: ../Doc/faq/programming.rst:1878
msgid ""
"In the standard library code, you will see several common patterns for "
"correctly using identity tests:"
msgstr ""
"En la librera estndar de cdigo, vers varios patrones comunes para usar "
"correctamente pruebas de identidad:"

#: ../Doc/faq/programming.rst:1881
msgid ""
"1) As recommended by :pep:`8`, an identity test is the preferred way to "
"check for ``None``.  This reads like plain English in code and avoids "
"confusion with other objects that may have boolean values that evaluate to "
"false."
msgstr ""
"1) Como es recomendado por :pep:`8`, una prueba de identidad es el mtodo "
"preferido para verificar si es ``None``.  Esto se lee como lenguaje normal "
"en el cdigo y evita confusin con otros objetos que puedan tener valores "
"booleanos que se evalen como falsos."

#: ../Doc/faq/programming.rst:1885
#, fuzzy
msgid ""
"2) Detecting optional arguments can be tricky when ``None`` is a valid input "
"value.  In those situations, you can create a singleton sentinel object "
"guaranteed to be distinct from other objects.  For example, here is how to "
"implement a method that behaves like :meth:`dict.pop`::"
msgstr ""
"2) La deteccin de argumentos opcionales puede resultar complicada cuando "
"``None`` es un valor de entrada vlido. En esas situaciones, puede crear un "
"objeto centinela singleton garantizado para ser distinto de otros objetos. "
"Por ejemplo, aqu se explica cmo implementar un mtodo que se comporta "
"como :meth:`dict.pop`:"

#: ../Doc/faq/programming.rst:1901
msgid ""
"3) Container implementations sometimes need to augment equality tests with "
"identity tests.  This prevents the code from being confused by objects such "
"as ``float('NaN')`` that are not equal to themselves."
msgstr ""
"3) Las implementaciones de contenedor a veces necesitan aumentar pruebas de "
"igualdad con pruebas de identidad.  Esto previene que el cdigo sea "
"confundido con objetos como ``float('NaN')`` que no son iguales que si "
"mismos."

#: ../Doc/faq/programming.rst:1905
#, fuzzy
msgid ""
"For example, here is the implementation of :meth:`!collections.abc.Sequence."
"__contains__`::"
msgstr ""
"Por ejemplo, ac est la implementacin de :meth:`collections.abc.Sequence."
"__contains__`::"

#: ../Doc/faq/programming.rst:1916
msgid ""
"How can a subclass control what data is stored in an immutable instance?"
msgstr ""
"Cmo puede una subclase controlar qu datos se almacenan en una instancia "
"inmutable?"

#: ../Doc/faq/programming.rst:1918
#, fuzzy
msgid ""
"When subclassing an immutable type, override the :meth:`~object.__new__` "
"method instead of the :meth:`~object.__init__` method.  The latter only runs "
"*after* an instance is created, which is too late to alter data in an "
"immutable instance."
msgstr ""
"Cuando se subclasifica un tipo inmutable, se debe anular el mtodo :meth:"
"`__new__` en lugar del mtodo :meth:`__init__`.  El ltimo solo corre "
"*despus* de que una instancia es creada, y entonces ya es muy tarde para "
"alterar datos en una instancia inmutable."

#: ../Doc/faq/programming.rst:1923
msgid ""
"All of these immutable classes have a different signature than their parent "
"class:"
msgstr ""
"Todas estas clases inmutables tienen una firma distinta que su clase padre:"

#: ../Doc/faq/programming.rst:1949
msgid "The classes can be used like this:"
msgstr "Las clases pueden ser utilizadas as:"

#: ../Doc/faq/programming.rst:1966
msgid "How do I cache method calls?"
msgstr "Cmo cacheo llamadas de mtodo?"

#: ../Doc/faq/programming.rst:1968
msgid ""
"The two principal tools for caching methods are :func:`functools."
"cached_property` and :func:`functools.lru_cache`.  The former stores results "
"at the instance level and the latter at the class level."
msgstr ""
"Las dos herramientas principales para cachear mtodos son :func:`functools."
"cached_property` y :func:`functools.lru_cache`.  El primero guarda "
"resultados a nivel de instancia y el ltimo a nivel de clase."

#: ../Doc/faq/programming.rst:1973
msgid ""
"The *cached_property* approach only works with methods that do not take any "
"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."
msgstr ""
"La funcin *cached_property* slo funciona con mtodos que no acepten "
"argumentos.  No crea una referencia a la instancia.  El resultado del mtodo "
"cacheado se mantendr solo mientras que la instancia est activa."

#: ../Doc/faq/programming.rst:1977
#, fuzzy
msgid ""
"The advantage is that when an instance is no longer used, the cached method "
"result will be released right away.  The disadvantage is that if instances "
"accumulate, so too will the accumulated method results.  They can grow "
"without bound."
msgstr ""
"La ventaja es que cuando una instancia ya no est siendo usada, el mtodo "
"cacheado ser liberado inmediatamente.  La desventaja es que si las "
"instancias se acumulan, tambin se acumularn los mtodos resultantes.  "
"Pueden crecer sin lmite."

#: ../Doc/faq/programming.rst:1982
#, fuzzy
msgid ""
"The *lru_cache* approach works with methods that have :term:`hashable` "
"arguments.  It creates a reference to the instance unless special efforts "
"are made to pass in weak references."
msgstr ""
"La funcin *lru_cache* funciona con mtodos que tienen argumentos "
"hashables.  Crea una referencia a la instancia a menos que esfuerzos "
"especiales sean realizados para pasar en referencias dbiles."

#: ../Doc/faq/programming.rst:1986
msgid ""
"The advantage of the least recently used algorithm is that the cache is "
"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."
msgstr ""
"La ventaja del algoritmo usado menos recientemente es que el cache est "
"limitado por el *maxsize* especificado.  La desventaja es que las instancias "
"se mantienen activas hasta que sean eliminadas del cache por edad o que el "
"cache sea borrado."

#: ../Doc/faq/programming.rst:1991
msgid "This example shows the various techniques::"
msgstr "Este ejemplo muestra las diversas tcnicas::"

#: ../Doc/faq/programming.rst:2015
msgid ""
"The above example assumes that the *station_id* never changes.  If the "
"relevant instance attributes are mutable, the *cached_property* approach "
"can't be made to work because it cannot detect changes to the attributes."
msgstr ""
"El ejemplo anterior asume que la *station_id* nunca cambia.  Si los "
"atributos de la instancia relevante son mutables, el mtodo de "
"*cached_property* no puede funcionar porque no puede detectar cambios en los "
"atributos."

#: ../Doc/faq/programming.rst:2020
#, fuzzy
msgid ""
"To make the *lru_cache* approach work when the *station_id* is mutable, the "
"class needs to define the :meth:`~object.__eq__` and :meth:`~object."
"__hash__` methods so that the cache can detect relevant attribute updates::"
msgstr ""
"Se puede hacer que el mtodo *lru_cache* funcione, pero la clase debe "
"definir los mtodos *__eq__* y *__hash__* para que el cache pueda detectar "
"cambios relevantes de atributo::"

#: ../Doc/faq/programming.rst:2046
msgid "Modules"
msgstr "Mdulos"

#: ../Doc/faq/programming.rst:2049
msgid "How do I create a .pyc file?"
msgstr "Cmo creo un fichero .pyc?"

#: ../Doc/faq/programming.rst:2051
msgid ""
"When a module is imported for the first time (or when the source file has "
"changed since the current compiled file was created) a ``.pyc`` file "
"containing the compiled code should be created in a ``__pycache__`` "
"subdirectory of the directory containing the ``.py`` file.  The ``.pyc`` "
"file will have a filename that starts with the same name as the ``.py`` "
"file, and ends with ``.pyc``, with a middle component that depends on the "
"particular ``python`` binary that created it.  (See :pep:`3147` for details.)"
msgstr ""
"Cuando se importa un mdulo por primera vez (o cuando el cdigo fuente ha "
"cambiado desde que el fichero compilado se cre) un fichero ``.pyc`` que "
"contiene el cdigo compilado se debera crear en la subcarpeta "
"``__pycache__`` del directorio que contiene al fichero ``.py``.  El fichero "
"``.pyc`` tendr un nombre que empezar con el mismo nombre que el del "
"fichero  ``.py`` y terminar con ``.pyc``, con un componente intermedio que "
"depender del binario ``python`` en particular que lo cre.  (Ver :pep:"
"`3147` para detalles.)"

#: ../Doc/faq/programming.rst:2059
msgid ""
"One reason that a ``.pyc`` file may not be created is a permissions problem "
"with the directory containing the source file, meaning that the "
"``__pycache__`` subdirectory cannot be created. This can happen, for "
"example, if you develop as one user but run as another, such as if you are "
"testing with a web server."
msgstr ""
"Una razn por la que no se cree un fichero ``.pyc`` podra ser debido a un "
"problema de permisos del directorio que contiene al fichero fuente, lo que "
"significa que el subdirectorio ``__pycache__`` no se puede crear. Esto puede "
"suceder, por ejemplo, si desarrollas como un usuario pero lo ejecutas como "
"otro, como si estuvieras probando en un servidor web."

#: ../Doc/faq/programming.rst:2064
msgid ""
"Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, "
"creation of a .pyc file is automatic if you're importing a module and Python "
"has the ability (permissions, free space, etc...) to create a "
"``__pycache__`` subdirectory and write the compiled module to that "
"subdirectory."
msgstr ""
"Hasta que no definas la variable de entorno :envvar:"
"`PYTHONDONTWRITEBYTECODE`, la creacin de un fichero .pyc se har "
"automticamente si importas un mdulo y Python dispone de la habilidad "
"(permisos, espacio libre, etc...) para crear un subdirectorio "
"``__pycache__`` y escribir un mdulo compilado en ese subdirectorio."

#: ../Doc/faq/programming.rst:2069
msgid ""
"Running Python on a top level script is not considered an import and no ``."
"pyc`` will be created.  For example, if you have a top-level module ``foo."
"py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing "
"``python foo.py`` as a shell command), a ``.pyc`` will be created for "
"``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created "
"for ``foo`` since ``foo.py`` isn't being imported."
msgstr ""
"La ejecucin de un script principal Python no se considera una importacin y "
"no se crea el fichero ``.pyc``.  Por ejemplo, Si tienes un mdulo principal "
"``foo.py`` que importa a otro mdulo ``xyz.py``, cuando ejecutas ``foo`` "
"(mediante un comando de la shell ``python foo.py``), se crear un fichero ``."
"pyc`` para ``xyz`` porque ``xyz`` ha sido importado, pero no se crear un "
"fichero ``.pyc`` para ``foo`` ya que ``foo.py`` no ha sido importado."

#: ../Doc/faq/programming.rst:2076
msgid ""
"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``."
"pyc`` file for a module that is not imported -- you can, using the :mod:"
"`py_compile` and :mod:`compileall` modules."
msgstr ""
"Si necesitas crear un fichero ``.pyc`` tambin para ``foo`` -- es decir, "
"crear un fichero ``.pyc`` para un mdulo que no ha sido importado -- puedes "
"usar los mdulos :mod:`py_compile` y :mod:`compileall`."

#: ../Doc/faq/programming.rst:2080
msgid ""
"The :mod:`py_compile` module can manually compile any module.  One way is to "
"use the ``compile()`` function in that module interactively::"
msgstr ""
"El mdulo :mod:`py_compile` puede compilar manualmente cualquier mdulo.  "
"Una forma sera usando la funcin ``compile()`` de ese mdulo de forma "
"interactiva::"

#: ../Doc/faq/programming.rst:2086
msgid ""
"This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same "
"location as ``foo.py`` (or you can override that with the optional parameter "
"``cfile``)."
msgstr ""
"Esto escribir ``.pyc`` en el subdirectorio ``__pycache__`` en la misma "
"localizacin en la que se encuentre ``foo.py`` (o, puedes sobreescribir ese "
"comportamiento con el parmetro opcional ``cfile``)."

#: ../Doc/faq/programming.rst:2090
msgid ""
"You can also automatically compile all files in a directory or directories "
"using the :mod:`compileall` module.  You can do it from the shell prompt by "
"running ``compileall.py`` and providing the path of a directory containing "
"Python files to compile::"
msgstr ""
"Puedes compilar automticamente todos los ficheros en un directorio o "
"directorios usando el mdulo :mod:`compileall`.  Lo puedes hacer desde la "
"lnea de comandos ejecutando ``compileall.py`` y proporcionando una ruta al "
"directorio que contiene los ficheros Python a compilar::"

#: ../Doc/faq/programming.rst:2099
msgid "How do I find the current module name?"
msgstr "Cmo puedo encontrar el nombre del mdulo en uso?"

#: ../Doc/faq/programming.rst:2101
msgid ""
"A module can find out its own module name by looking at the predefined "
"global variable ``__name__``.  If this has the value ``'__main__'``, the "
"program is running as a script.  Many modules that are usually used by "
"importing them also provide a command-line interface or a self-test, and "
"only execute this code after checking ``__name__``::"
msgstr ""
"Un mdulo puede encontrar su propio nombre mirando en la variable global "
"predeterminada ``__name__``.  Si tiene el valor ``'__main__'``, el programa "
"se est ejecutando como un script.  Muchos mdulos que se usan, "
"generalmente, importados en otro script proporcionan, adems, una interfaz "
"para la lnea de comandos o para probarse a si mismos y solo ejecutan cdigo "
"despus de comprobar ``__name__``::"

#: ../Doc/faq/programming.rst:2116
msgid "How can I have modules that mutually import each other?"
msgstr "Cmo podra tener mdulos que se importan mutuamente entre ellos?"

#: ../Doc/faq/programming.rst:2118
msgid "Suppose you have the following modules:"
msgstr "Supn que tienes los siguientes mdulos:"

#: ../Doc/faq/programming.rst:2120
msgid ":file:`foo.py`::"
msgstr ":file:`foo.py`::"

#: ../Doc/faq/programming.rst:2125
msgid ":file:`bar.py`::"
msgstr ":file:`bar.py`::"

#: ../Doc/faq/programming.rst:2130
msgid "The problem is that the interpreter will perform the following steps:"
msgstr "El problema es que el intrprete realizar los siguientes pasos:"

#: ../Doc/faq/programming.rst:2132
msgid "main imports ``foo``"
msgstr "main importa a ``foo``"

#: ../Doc/faq/programming.rst:2133
msgid "Empty globals for ``foo`` are created"
msgstr "Se crean *globals* vacos para foo"

#: ../Doc/faq/programming.rst:2134
msgid "``foo`` is compiled and starts executing"
msgstr "``foo`` se compila y se comienza a ejecutar"

#: ../Doc/faq/programming.rst:2135
msgid "``foo`` imports ``bar``"
msgstr "``foo`` importa a ``bar``"

#: ../Doc/faq/programming.rst:2136
msgid "Empty globals for ``bar`` are created"
msgstr "Se crean *globals* vacos para ``bar``"

#: ../Doc/faq/programming.rst:2137
msgid "``bar`` is compiled and starts executing"
msgstr "``bar`` se compila y se comienza a ejecutar"

#: ../Doc/faq/programming.rst:2138
msgid ""
"``bar`` imports ``foo`` (which is a no-op since there already is a module "
"named ``foo``)"
msgstr ""
"``bar`` importa a ``foo`` (lo cual es un no-op ya que ya hay un mdulo que "
"se llama ``foo``)"

#: ../Doc/faq/programming.rst:2139
msgid ""
"The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set "
"``bar.foo_var = foo.foo_var``"
msgstr ""
"El mecanismo de importado intenta leer ``foo_var`` de globales de ``foo``, "
"para establecer ``bar.foo_var = foo.foo_var``"

#: ../Doc/faq/programming.rst:2141
msgid ""
"The last step fails, because Python isn't done with interpreting ``foo`` yet "
"and the global symbol dictionary for ``foo`` is still empty."
msgstr ""
"El ltimo paso falla debido a que Python todava no ha terminado de "
"interpretar a ``foo`` y el diccionario de smbolos global para ``foo`` "
"todava se encuentra vaco."

#: ../Doc/faq/programming.rst:2144
msgid ""
"The same thing happens when you use ``import foo``, and then try to access "
"``foo.foo_var`` in global code."
msgstr ""
"Lo mismo ocurre cuando usas ``import foo`` y luego tratas de acceder a ``foo."
"foo_var`` en un cdigo global."

#: ../Doc/faq/programming.rst:2147
msgid "There are (at least) three possible workarounds for this problem."
msgstr "Existen (al menos) tres posibles soluciones para este problema."

#: ../Doc/faq/programming.rst:2149
msgid ""
"Guido van Rossum recommends avoiding all uses of ``from  import ..."
"``, and placing all code inside functions.  Initializations of global "
"variables and class variables should use constants or built-in functions "
"only.  This means everything from an imported module is referenced as "
"``.``."
msgstr ""
"Guido van Rossum recomienda evitar todos los usos de ``from  "
"import ...``, y colocar todo el cdigo dentro de funciones.  La "
"inicializacin de variables globales y variables de clase debera usar "
"nicamente constantes o funciones incorporadas .  Esto significa que todo se "
"referenciar como ``.`` desde un mdulo importado."

#: ../Doc/faq/programming.rst:2154
msgid ""
"Jim Roskind suggests performing steps in the following order in each module:"
msgstr ""
"Jim Roskind sugiere realizar los siguientes pasos en el siguiente orden en "
"cada mdulo:"

#: ../Doc/faq/programming.rst:2156
msgid ""
"exports (globals, functions, and classes that don't need imported base "
"classes)"
msgstr ""
"exportar (*globals*, funciones y clases que no necesitan clases bases "
"importadas)"

#: ../Doc/faq/programming.rst:2158
msgid "``import`` statements"
msgstr "``import`` declaraciones"

#: ../Doc/faq/programming.rst:2159
msgid ""
"active code (including globals that are initialized from imported values)."
msgstr ""
"cdigo activo (incluyendo *globals* que han sido inicializados desde valores "
"importados)."

#: ../Doc/faq/programming.rst:2161
#, fuzzy
msgid ""
"Van Rossum doesn't like this approach much because the imports appear in a "
"strange place, but it does work."
msgstr ""
"este enfoque no le gusta mucho a van Rossum debido a que los import aparecen "
"en lugares extraos, pero funciona."

#: ../Doc/faq/programming.rst:2164
msgid ""
"Matthias Urlichs recommends restructuring your code so that the recursive "
"import is not necessary in the first place."
msgstr ""
"Matthias Urlichs recomienda reestructurar tu cdigo de tal forma que un "
"import recursivo no sea necesario."

#: ../Doc/faq/programming.rst:2167
msgid "These solutions are not mutually exclusive."
msgstr "Estas soluciones no son mutuamente excluyentes."

#: ../Doc/faq/programming.rst:2171
msgid "__import__('x.y.z') returns ; how do I get z?"
msgstr "__import__('x.y.z') devuelve ; cmo puedo obtener z?"

#: ../Doc/faq/programming.rst:2173
msgid ""
"Consider using the convenience function :func:`~importlib.import_module` "
"from :mod:`importlib` instead::"
msgstr ""
"Considera, en su lugar, usa la funcin de conveniencia :func:`~importlib."
"import_module` de :mod:`importlib`::"

#: ../Doc/faq/programming.rst:2180
msgid ""
"When I edit an imported module and reimport it, the changes don't show up.  "
"Why does this happen?"
msgstr ""
"Cuando edito un mdulo importado y lo reimporto los cambios no tienen "
"efecto. Por qu sucede esto?"

#: ../Doc/faq/programming.rst:2182
msgid ""
"For reasons of efficiency as well as consistency, Python only reads the "
"module file on the first time a module is imported.  If it didn't, in a "
"program consisting of many modules where each one imports the same basic "
"module, the basic module would be parsed and re-parsed many times.  To force "
"re-reading of a changed module, do this::"
msgstr ""
"Por razones de eficiencia adems de por consistencia, Python solo lee el "
"fichero del mdulo la primera vez que el mdulo se importa.  Si no lo "
"hiciera as, un programa escrito en muchos mdulos donde cada mdulo importa "
"al mismo mdulo bsico estara analizando sintcticamente el mismo mdulo "
"bsico muchas veces.  Para forzar una relectura de un mdulo que ha sido "
"modificado haz lo siguiente::"

#: ../Doc/faq/programming.rst:2192
#, python-format
msgid ""
"Warning: this technique is not 100% fool-proof.  In particular, modules "
"containing statements like ::"
msgstr ""
"Alerta: esta tcnica no es 100% segura.  En particular, los mdulos que "
"contienen declaraciones como ::"

#: ../Doc/faq/programming.rst:2197
msgid ""
"will continue to work with the old version of the imported objects.  If the "
"module contains class definitions, existing class instances will *not* be "
"updated to use the new class definition.  This can result in the following "
"paradoxical behaviour::"
msgstr ""
"continuarn funcionando con la versin antigua de los objetos importados.  "
"Si el mdulo contiene definiciones de clase, instancias de clase ya "
"existentes *no* se actualizarn para usar la nueva definicin de la clase.  "
"Esto podra resultar en el comportamiento paradjico siguiente::"

#: ../Doc/faq/programming.rst:2210
msgid ""
"The nature of the problem is made clear if you print out the \"identity\" of "
"the class objects::"
msgstr ""
"La naturaleza del problema se hace evidente si muestras la \"identity\" de "
"los objetos clase::"

#: ../Doc/faq/programming.rst:408
msgid "argument"
msgstr ""

#: ../Doc/faq/programming.rst:408
msgid "difference from parameter"
msgstr ""

#: ../Doc/faq/programming.rst:408
msgid "parameter"
msgstr ""

#: ../Doc/faq/programming.rst:408
msgid "difference from argument"
msgstr ""

#~ msgid "Use a list comprehension::"
#~ msgstr "Usa una comprensin de listas::"

Web Proxy Viewer  |  New URL  |  Original Page