diff --git a/library/2to3.po b/library/2to3.po index 3eac52dbcd..abc3f867df 100644 --- a/library/2to3.po +++ b/library/2to3.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-12-14 00:10+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -197,11 +197,11 @@ msgstr "" msgid "Replaces deprecated :mod:`unittest` method names with the correct ones." msgstr "" -#: ../../library/2to3.rst:162 ../../library/2to3.rst:350 +#: ../../library/2to3.rst:162 ../../library/2to3.rst:351 msgid "From" msgstr "從" -#: ../../library/2to3.rst:162 ../../library/2to3.rst:350 +#: ../../library/2to3.rst:162 ../../library/2to3.rst:351 msgid "To" msgstr "到" @@ -438,14 +438,16 @@ msgid "" msgstr "" #: ../../library/2to3.rst:336 -msgid "Renames :meth:`__nonzero__` to :meth:`~object.__bool__`." +msgid "" +"Renames definitions of methods called :meth:`__nonzero__` to :meth:`~object." +"__bool__`." msgstr "" -#: ../../library/2to3.rst:340 +#: ../../library/2to3.rst:341 msgid "Converts octal literals into the new syntax." msgstr "" -#: ../../library/2to3.rst:344 +#: ../../library/2to3.rst:345 msgid "" "Converts calls to various functions in the :mod:`operator` module to other, " "but equivalent, function calls. When needed, the appropriate ``import`` " @@ -453,172 +455,172 @@ msgid "" "mapping are made:" msgstr "" -#: ../../library/2to3.rst:352 +#: ../../library/2to3.rst:353 msgid "``operator.isCallable(obj)``" msgstr "``operator.isCallable(obj)``" -#: ../../library/2to3.rst:352 +#: ../../library/2to3.rst:353 msgid "``callable(obj)``" msgstr "``callable(obj)``" -#: ../../library/2to3.rst:353 +#: ../../library/2to3.rst:354 msgid "``operator.sequenceIncludes(obj)``" msgstr "``operator.sequenceIncludes(obj)``" -#: ../../library/2to3.rst:353 +#: ../../library/2to3.rst:354 msgid "``operator.contains(obj)``" msgstr "``operator.contains(obj)``" -#: ../../library/2to3.rst:354 +#: ../../library/2to3.rst:355 msgid "``operator.isSequenceType(obj)``" msgstr "``operator.isSequenceType(obj)``" -#: ../../library/2to3.rst:354 +#: ../../library/2to3.rst:355 msgid "``isinstance(obj, collections.abc.Sequence)``" msgstr "``isinstance(obj, collections.abc.Sequence)``" -#: ../../library/2to3.rst:355 +#: ../../library/2to3.rst:356 msgid "``operator.isMappingType(obj)``" msgstr "``operator.isMappingType(obj)``" -#: ../../library/2to3.rst:355 +#: ../../library/2to3.rst:356 msgid "``isinstance(obj, collections.abc.Mapping)``" msgstr "``isinstance(obj, collections.abc.Mapping)``" -#: ../../library/2to3.rst:356 +#: ../../library/2to3.rst:357 msgid "``operator.isNumberType(obj)``" msgstr "``operator.isNumberType(obj)``" -#: ../../library/2to3.rst:356 +#: ../../library/2to3.rst:357 msgid "``isinstance(obj, numbers.Number)``" msgstr "``isinstance(obj, numbers.Number)``" -#: ../../library/2to3.rst:357 +#: ../../library/2to3.rst:358 msgid "``operator.repeat(obj, n)``" msgstr "``operator.repeat(obj, n)``" -#: ../../library/2to3.rst:357 +#: ../../library/2to3.rst:358 msgid "``operator.mul(obj, n)``" msgstr "``operator.mul(obj, n)``" -#: ../../library/2to3.rst:358 +#: ../../library/2to3.rst:359 msgid "``operator.irepeat(obj, n)``" msgstr "``operator.irepeat(obj, n)``" -#: ../../library/2to3.rst:358 +#: ../../library/2to3.rst:359 msgid "``operator.imul(obj, n)``" msgstr "``operator.imul(obj, n)``" -#: ../../library/2to3.rst:363 +#: ../../library/2to3.rst:364 msgid "" "Add extra parenthesis where they are required in list comprehensions. For " "example, ``[x for x in 1, 2]`` becomes ``[x for x in (1, 2)]``." msgstr "" -#: ../../library/2to3.rst:368 +#: ../../library/2to3.rst:369 msgid "Converts the ``print`` statement to the :func:`print` function." msgstr "" -#: ../../library/2to3.rst:372 +#: ../../library/2to3.rst:373 msgid "" "Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise " "E(V).with_traceback(T)``. If ``E`` is a tuple, the translation will be " "incorrect because substituting tuples for exceptions has been removed in 3.0." msgstr "" -#: ../../library/2to3.rst:378 +#: ../../library/2to3.rst:379 msgid "Converts :func:`raw_input` to :func:`input`." msgstr "" -#: ../../library/2to3.rst:382 +#: ../../library/2to3.rst:383 msgid "Handles the move of :func:`reduce` to :func:`functools.reduce`." msgstr "" -#: ../../library/2to3.rst:386 +#: ../../library/2to3.rst:387 msgid "Converts :func:`reload` to :func:`importlib.reload`." msgstr "" -#: ../../library/2to3.rst:390 +#: ../../library/2to3.rst:391 msgid "Changes :data:`sys.maxint` to :data:`sys.maxsize`." msgstr "" -#: ../../library/2to3.rst:394 +#: ../../library/2to3.rst:395 msgid "Replaces backtick repr with the :func:`repr` function." msgstr "" -#: ../../library/2to3.rst:398 +#: ../../library/2to3.rst:399 msgid "" "Replaces use of the :class:`set` constructor with set literals. This fixer " "is optional." msgstr "" -#: ../../library/2to3.rst:403 +#: ../../library/2to3.rst:404 msgid "Renames :exc:`StandardError` to :exc:`Exception`." msgstr "" -#: ../../library/2to3.rst:407 +#: ../../library/2to3.rst:408 msgid "" "Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`, :data:" "`sys.exc_traceback` to use :func:`sys.exc_info`." msgstr "" -#: ../../library/2to3.rst:412 +#: ../../library/2to3.rst:413 msgid "Fixes the API change in generator's :meth:`throw` method." msgstr "" -#: ../../library/2to3.rst:416 +#: ../../library/2to3.rst:417 msgid "" "Removes implicit tuple parameter unpacking. This fixer inserts temporary " "variables." msgstr "" -#: ../../library/2to3.rst:421 +#: ../../library/2to3.rst:422 msgid "" "Fixes code broken from the removal of some members in the :mod:`types` " "module." msgstr "" -#: ../../library/2to3.rst:426 +#: ../../library/2to3.rst:427 msgid "Renames :class:`unicode` to :class:`str`." msgstr "" -#: ../../library/2to3.rst:430 +#: ../../library/2to3.rst:431 msgid "" "Handles the rename of :mod:`urllib` and :mod:`urllib2` to the :mod:`urllib` " "package." msgstr "" -#: ../../library/2to3.rst:435 +#: ../../library/2to3.rst:436 msgid "" "Removes excess whitespace from comma separated items. This fixer is " "optional." msgstr "" -#: ../../library/2to3.rst:440 +#: ../../library/2to3.rst:441 msgid "" "Renames :func:`xrange` to :func:`range` and wraps existing :func:`range` " "calls with :class:`list`." msgstr "" -#: ../../library/2to3.rst:445 +#: ../../library/2to3.rst:446 msgid "Changes ``for x in file.xreadlines()`` to ``for x in file``." msgstr "" -#: ../../library/2to3.rst:449 +#: ../../library/2to3.rst:450 msgid "" "Wraps :func:`zip` usage in a :class:`list` call. This is disabled when " "``from future_builtins import zip`` appears." msgstr "" -#: ../../library/2to3.rst:454 +#: ../../library/2to3.rst:455 msgid ":mod:`lib2to3` - 2to3's library" msgstr "" -#: ../../library/2to3.rst:463 +#: ../../library/2to3.rst:464 msgid "**Source code:** :source:`Lib/lib2to3/`" msgstr "**原始碼:**\\ :source:`Lib/lib2to3/`" -#: ../../library/2to3.rst:476 +#: ../../library/2to3.rst:477 msgid "" "Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is using " "a less flexible LL(1) parser. Python 3.10 includes new language syntax that " @@ -630,7 +632,7 @@ msgid "" "or `parso`_." msgstr "" -#: ../../library/2to3.rst:479 +#: ../../library/2to3.rst:480 msgid "" "The :mod:`lib2to3` API should be considered unstable and may change " "drastically in the future." diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 1a4ce64b6b..c66682c8bb 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-12-02 00:09+0000\n" +"POT-Creation-Date: 2021-12-14 00:10+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,7 +105,7 @@ msgid "Set *loop* as a current event loop for the current OS thread." msgstr "" #: ../../library/asyncio-eventloop.rst:67 -msgid "Create a new event loop object." +msgid "Create and return a new event loop object." msgstr "" #: ../../library/asyncio-eventloop.rst:69 diff --git a/library/audit_events.po b/library/audit_events.po index 202e21569a..b20e872f7c 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2021-12-11 08:29+0000\n" "PO-Revision-Date: 2021-12-06 21:50+0800\n" +"Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Last-Translator: Jordan Su \n" "X-Generator: Poedit 3.0\n" #: ../../library/audit_events.rst:6 diff --git a/library/functions.po b/library/functions.po index 54b1488acd..b0d8d0ac9e 100644 --- a/library/functions.po +++ b/library/functions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-23 00:09+0000\n" +"POT-Creation-Date: 2021-12-11 08:29+0000\n" "PO-Revision-Date: 2018-11-10 18:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1443,10 +1443,9 @@ msgstr "" #: ../../library/functions.rst:736 #, fuzzy msgid "" -"Return a dictionary representing the current global symbol table. This is " -"always the dictionary of the current module (inside a function or method, " -"this is the module where it is defined, not the module from which it is " -"called)." +"Return the dictionary implementing the current module namespace. For code " +"within functions, this is set when the function is defined and remains the " +"same regardless of where the function is called." msgstr "" "返回表示當前全域性符號表的字典。這總是當前模組的字典(在函式或方法中,不是呼" "叫它的模組,而是定義它的模組)。" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index 2594d333bb..750fd219c1 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-12-14 09:35+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -147,8 +147,8 @@ msgstr "" #: ../../library/logging.handlers.rst:105 #: ../../library/logging.handlers.rst:187 -#: ../../library/logging.handlers.rst:322 -#: ../../library/logging.handlers.rst:428 +#: ../../library/logging.handlers.rst:335 +#: ../../library/logging.handlers.rst:441 msgid "" "As well as string values, :class:`~pathlib.Path` objects are also accepted " "for the *filename* argument." @@ -156,8 +156,8 @@ msgstr "" #: ../../library/logging.handlers.rst:109 #: ../../library/logging.handlers.rst:191 -#: ../../library/logging.handlers.rst:326 -#: ../../library/logging.handlers.rst:432 +#: ../../library/logging.handlers.rst:339 +#: ../../library/logging.handlers.rst:445 msgid "The *errors* parameter was added." msgstr "新增 *errors* 參數。" @@ -288,37 +288,54 @@ msgid "" "as expected." msgstr "" -#: ../../library/logging.handlers.rst:239 +#: ../../library/logging.handlers.rst:234 +msgid "" +"It's also worth noting that care should be taken when using a namer to " +"preserve certain attributes in the filename which are used during rotation. " +"For example, :class:`RotatingFileHandler` expects to have a set of log files " +"whose names contain successive integers, so that rotation works as expected, " +"and :class:`TimedRotatingFileHandler` deletes old log files (based on the " +"``backupCount`` parameter passed to the handler's initializer) by " +"determining the oldest files to delete. For this to happen, the filenames " +"should be sortable using the date/time portion of the filename, and a namer " +"needs to respect this. (If a namer is wanted that doesn't respect this " +"scheme, it will need to be used in a subclass of :class:" +"`TimedRotatingFileHandler` which overrides the :meth:" +"`~TimedRotatingFileHandler.getFilesToDelete` method to fit in with the " +"custom naming scheme.)" +msgstr "" + +#: ../../library/logging.handlers.rst:252 msgid "" "If this attribute is set to a callable, the :meth:`rotate` method delegates " "to this callable. The parameters passed to the callable are those passed " "to :meth:`rotate`." msgstr "" -#: ../../library/logging.handlers.rst:247 +#: ../../library/logging.handlers.rst:260 msgid "Modify the filename of a log file when rotating." msgstr "" -#: ../../library/logging.handlers.rst:249 +#: ../../library/logging.handlers.rst:262 msgid "This is provided so that a custom filename can be provided." msgstr "" -#: ../../library/logging.handlers.rst:251 +#: ../../library/logging.handlers.rst:264 msgid "" "The default implementation calls the 'namer' attribute of the handler, if " "it's callable, passing the default name to it. If the attribute isn't " "callable (the default is ``None``), the name is returned unchanged." msgstr "" -#: ../../library/logging.handlers.rst:255 +#: ../../library/logging.handlers.rst:268 msgid "The default name for the log file." msgstr "" -#: ../../library/logging.handlers.rst:262 +#: ../../library/logging.handlers.rst:275 msgid "When rotating, rotate the current log." msgstr "" -#: ../../library/logging.handlers.rst:264 +#: ../../library/logging.handlers.rst:277 msgid "" "The default implementation calls the 'rotator' attribute of the handler, if " "it's callable, passing the source and dest arguments to it. If the attribute " @@ -326,18 +343,18 @@ msgid "" "the destination." msgstr "" -#: ../../library/logging.handlers.rst:269 +#: ../../library/logging.handlers.rst:282 msgid "" "The source filename. This is normally the base filename, e.g. 'test.log'." msgstr "" -#: ../../library/logging.handlers.rst:271 +#: ../../library/logging.handlers.rst:284 msgid "" "The destination filename. This is normally what the source is rotated to, e." "g. 'test.log.1'." msgstr "" -#: ../../library/logging.handlers.rst:276 +#: ../../library/logging.handlers.rst:289 msgid "" "The reason the attributes exist is to save you having to subclass - you can " "use the same callables for instances of :class:`RotatingFileHandler` and :" @@ -347,27 +364,27 @@ msgid "" "method of the handler." msgstr "" -#: ../../library/logging.handlers.rst:283 +#: ../../library/logging.handlers.rst:296 msgid "" "If you need to make more significant changes to rotation processing, you can " "override the methods." msgstr "" -#: ../../library/logging.handlers.rst:286 +#: ../../library/logging.handlers.rst:299 msgid "For an example, see :ref:`cookbook-rotator-namer`." msgstr "" -#: ../../library/logging.handlers.rst:292 +#: ../../library/logging.handlers.rst:305 msgid "RotatingFileHandler" msgstr "RotatingFileHandler" -#: ../../library/logging.handlers.rst:294 +#: ../../library/logging.handlers.rst:307 msgid "" "The :class:`RotatingFileHandler` class, located in the :mod:`logging." "handlers` module, supports rotation of disk log files." msgstr "" -#: ../../library/logging.handlers.rst:300 +#: ../../library/logging.handlers.rst:313 msgid "" "Returns a new instance of the :class:`RotatingFileHandler` class. The " "specified file is opened and used as the stream for logging. If *mode* is " @@ -378,7 +395,7 @@ msgid "" "errors are handled." msgstr "" -#: ../../library/logging.handlers.rst:307 +#: ../../library/logging.handlers.rst:320 msgid "" "You can use the *maxBytes* and *backupCount* values to allow the file to :" "dfn:`rollover` at a predetermined size. When the size is about to be " @@ -396,29 +413,29 @@ msgid "" "they are renamed to :file:`app.log.2`, :file:`app.log.3` etc. respectively." msgstr "" -#: ../../library/logging.handlers.rst:331 -#: ../../library/logging.handlers.rst:437 +#: ../../library/logging.handlers.rst:344 +#: ../../library/logging.handlers.rst:450 msgid "Does a rollover, as described above." msgstr "" -#: ../../library/logging.handlers.rst:336 +#: ../../library/logging.handlers.rst:349 msgid "" "Outputs the record to the file, catering for rollover as described " "previously." msgstr "" -#: ../../library/logging.handlers.rst:342 +#: ../../library/logging.handlers.rst:355 msgid "TimedRotatingFileHandler" msgstr "TimedRotatingFileHandler" -#: ../../library/logging.handlers.rst:344 +#: ../../library/logging.handlers.rst:357 msgid "" "The :class:`TimedRotatingFileHandler` class, located in the :mod:`logging." "handlers` module, supports rotation of disk log files at certain timed " "intervals." msgstr "" -#: ../../library/logging.handlers.rst:351 +#: ../../library/logging.handlers.rst:364 msgid "" "Returns a new instance of the :class:`TimedRotatingFileHandler` class. The " "specified file is opened and used as the stream for logging. On rotating it " @@ -426,112 +443,112 @@ msgid "" "*when* and *interval*." msgstr "" -#: ../../library/logging.handlers.rst:356 +#: ../../library/logging.handlers.rst:369 msgid "" "You can use the *when* to specify the type of *interval*. The list of " "possible values is below. Note that they are not case sensitive." msgstr "" -#: ../../library/logging.handlers.rst:360 +#: ../../library/logging.handlers.rst:373 msgid "Value" msgstr "" -#: ../../library/logging.handlers.rst:360 +#: ../../library/logging.handlers.rst:373 msgid "Type of interval" msgstr "" -#: ../../library/logging.handlers.rst:360 +#: ../../library/logging.handlers.rst:373 msgid "If/how *atTime* is used" msgstr "" -#: ../../library/logging.handlers.rst:362 +#: ../../library/logging.handlers.rst:375 msgid "``'S'``" msgstr "``'S'``" -#: ../../library/logging.handlers.rst:362 +#: ../../library/logging.handlers.rst:375 msgid "Seconds" msgstr "" -#: ../../library/logging.handlers.rst:362 -#: ../../library/logging.handlers.rst:364 -#: ../../library/logging.handlers.rst:366 -#: ../../library/logging.handlers.rst:368 +#: ../../library/logging.handlers.rst:375 +#: ../../library/logging.handlers.rst:377 +#: ../../library/logging.handlers.rst:379 +#: ../../library/logging.handlers.rst:381 msgid "Ignored" msgstr "" -#: ../../library/logging.handlers.rst:364 +#: ../../library/logging.handlers.rst:377 msgid "``'M'``" msgstr "``'M'``" -#: ../../library/logging.handlers.rst:364 +#: ../../library/logging.handlers.rst:377 msgid "Minutes" msgstr "" -#: ../../library/logging.handlers.rst:366 +#: ../../library/logging.handlers.rst:379 msgid "``'H'``" msgstr "``'H'``" -#: ../../library/logging.handlers.rst:366 +#: ../../library/logging.handlers.rst:379 msgid "Hours" msgstr "" -#: ../../library/logging.handlers.rst:368 +#: ../../library/logging.handlers.rst:381 msgid "``'D'``" msgstr "``'D'``" -#: ../../library/logging.handlers.rst:368 +#: ../../library/logging.handlers.rst:381 msgid "Days" msgstr "" -#: ../../library/logging.handlers.rst:370 +#: ../../library/logging.handlers.rst:383 msgid "``'W0'-'W6'``" msgstr "``'W0'-'W6'``" -#: ../../library/logging.handlers.rst:370 +#: ../../library/logging.handlers.rst:383 msgid "Weekday (0=Monday)" msgstr "" -#: ../../library/logging.handlers.rst:370 -#: ../../library/logging.handlers.rst:373 +#: ../../library/logging.handlers.rst:383 +#: ../../library/logging.handlers.rst:386 msgid "Used to compute initial rollover time" msgstr "" -#: ../../library/logging.handlers.rst:373 +#: ../../library/logging.handlers.rst:386 msgid "``'midnight'``" msgstr "``'midnight'``" -#: ../../library/logging.handlers.rst:373 +#: ../../library/logging.handlers.rst:386 msgid "Roll over at midnight, if *atTime* not specified, else at time *atTime*" msgstr "" -#: ../../library/logging.handlers.rst:378 +#: ../../library/logging.handlers.rst:391 msgid "" "When using weekday-based rotation, specify 'W0' for Monday, 'W1' for " "Tuesday, and so on up to 'W6' for Sunday. In this case, the value passed for " "*interval* isn't used." msgstr "" -#: ../../library/logging.handlers.rst:382 +#: ../../library/logging.handlers.rst:395 msgid "" "The system will save old log files by appending extensions to the filename. " "The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_" "%H-%M-%S`` or a leading portion thereof, depending on the rollover interval." msgstr "" -#: ../../library/logging.handlers.rst:387 +#: ../../library/logging.handlers.rst:400 msgid "" "When computing the next rollover time for the first time (when the handler " "is created), the last modification time of an existing log file, or else the " "current time, is used to compute when the next rotation will occur." msgstr "" -#: ../../library/logging.handlers.rst:391 +#: ../../library/logging.handlers.rst:404 msgid "" "If the *utc* argument is true, times in UTC will be used; otherwise local " "time is used." msgstr "" -#: ../../library/logging.handlers.rst:394 +#: ../../library/logging.handlers.rst:407 msgid "" "If *backupCount* is nonzero, at most *backupCount* files will be kept, and " "if more would be created when rollover occurs, the oldest one is deleted. " @@ -539,13 +556,13 @@ msgid "" "changing the interval may leave old files lying around." msgstr "" -#: ../../library/logging.handlers.rst:399 +#: ../../library/logging.handlers.rst:412 msgid "" "If *delay* is true, then file opening is deferred until the first call to :" "meth:`emit`." msgstr "" -#: ../../library/logging.handlers.rst:402 +#: ../../library/logging.handlers.rst:415 msgid "" "If *atTime* is not ``None``, it must be a ``datetime.time`` instance which " "specifies the time of day when rollover occurs, for the cases where rollover " @@ -555,13 +572,13 @@ msgid "" "normal interval calculation." msgstr "" -#: ../../library/logging.handlers.rst:409 +#: ../../library/logging.handlers.rst:422 msgid "" "If *errors* is specified, it's used to determine how encoding errors are " "handled." msgstr "" -#: ../../library/logging.handlers.rst:412 +#: ../../library/logging.handlers.rst:425 msgid "" "Calculation of the initial rollover time is done when the handler is " "initialised. Calculation of subsequent rollover times is done only when " @@ -576,44 +593,51 @@ msgid "" "to the minutes where no output (and hence no rollover) occurred." msgstr "" -#: ../../library/logging.handlers.rst:425 +#: ../../library/logging.handlers.rst:438 msgid "*atTime* parameter was added." msgstr "新增 *atTime* 參數。" -#: ../../library/logging.handlers.rst:441 +#: ../../library/logging.handlers.rst:454 msgid "" "Outputs the record to the file, catering for rollover as described above." msgstr "" -#: ../../library/logging.handlers.rst:447 +#: ../../library/logging.handlers.rst:458 +msgid "" +"Returns a list of filenames which should be deleted as part of rollover. " +"These are the absolute paths of the oldest backup log files written by the " +"handler." +msgstr "" + +#: ../../library/logging.handlers.rst:464 msgid "SocketHandler" msgstr "SocketHandler" -#: ../../library/logging.handlers.rst:449 +#: ../../library/logging.handlers.rst:466 msgid "" "The :class:`SocketHandler` class, located in the :mod:`logging.handlers` " "module, sends logging output to a network socket. The base class uses a TCP " "socket." msgstr "" -#: ../../library/logging.handlers.rst:455 +#: ../../library/logging.handlers.rst:472 msgid "" "Returns a new instance of the :class:`SocketHandler` class intended to " "communicate with a remote machine whose address is given by *host* and " "*port*." msgstr "" -#: ../../library/logging.handlers.rst:458 +#: ../../library/logging.handlers.rst:475 msgid "" "If ``port`` is specified as ``None``, a Unix domain socket is created using " "the value in ``host`` - otherwise, a TCP socket is created." msgstr "" -#: ../../library/logging.handlers.rst:464 +#: ../../library/logging.handlers.rst:481 msgid "Closes the socket." msgstr "" -#: ../../library/logging.handlers.rst:469 +#: ../../library/logging.handlers.rst:486 msgid "" "Pickles the record's attribute dictionary and writes it to the socket in " "binary format. If there is an error with the socket, silently drops the " @@ -622,28 +646,28 @@ msgid "" "`~logging.LogRecord`, use the :func:`~logging.makeLogRecord` function." msgstr "" -#: ../../library/logging.handlers.rst:479 +#: ../../library/logging.handlers.rst:496 msgid "" "Handles an error which has occurred during :meth:`emit`. The most likely " "cause is a lost connection. Closes the socket so that we can retry on the " "next event." msgstr "" -#: ../../library/logging.handlers.rst:486 +#: ../../library/logging.handlers.rst:503 msgid "" "This is a factory method which allows subclasses to define the precise type " "of socket they want. The default implementation creates a TCP socket (:const:" "`socket.SOCK_STREAM`)." msgstr "" -#: ../../library/logging.handlers.rst:493 +#: ../../library/logging.handlers.rst:510 msgid "" "Pickles the record's attribute dictionary in binary format with a length " "prefix, and returns it ready for transmission across the socket. The details " "of this operation are equivalent to::" msgstr "" -#: ../../library/logging.handlers.rst:501 +#: ../../library/logging.handlers.rst:518 msgid "" "Note that pickles aren't completely secure. If you are concerned about " "security, you may want to override this method to implement a more secure " @@ -652,20 +676,20 @@ msgid "" "objects on the receiving end." msgstr "" -#: ../../library/logging.handlers.rst:510 +#: ../../library/logging.handlers.rst:527 msgid "" "Send a pickled byte-string *packet* to the socket. The format of the sent " "byte-string is as described in the documentation for :meth:`~SocketHandler." "makePickle`." msgstr "" -#: ../../library/logging.handlers.rst:514 +#: ../../library/logging.handlers.rst:531 msgid "" "This function allows for partial sends, which can happen when the network is " "busy." msgstr "" -#: ../../library/logging.handlers.rst:520 +#: ../../library/logging.handlers.rst:537 msgid "" "Tries to create a socket; on failure, uses an exponential back-off " "algorithm. On initial failure, the handler will drop the message it was " @@ -676,23 +700,23 @@ msgid "" "each time up to a maximum of 30 seconds." msgstr "" -#: ../../library/logging.handlers.rst:528 +#: ../../library/logging.handlers.rst:545 msgid "This behaviour is controlled by the following handler attributes:" msgstr "" -#: ../../library/logging.handlers.rst:530 +#: ../../library/logging.handlers.rst:547 msgid "``retryStart`` (initial delay, defaulting to 1.0 seconds)." msgstr "" -#: ../../library/logging.handlers.rst:531 +#: ../../library/logging.handlers.rst:548 msgid "``retryFactor`` (multiplier, defaulting to 2.0)." msgstr "" -#: ../../library/logging.handlers.rst:532 +#: ../../library/logging.handlers.rst:549 msgid "``retryMax`` (maximum delay, defaulting to 30.0 seconds)." msgstr "" -#: ../../library/logging.handlers.rst:534 +#: ../../library/logging.handlers.rst:551 msgid "" "This means that if the remote listener starts up *after* the handler has " "been used, you could lose messages (since the handler won't even attempt a " @@ -700,31 +724,31 @@ msgid "" "during the delay period)." msgstr "" -#: ../../library/logging.handlers.rst:543 +#: ../../library/logging.handlers.rst:560 msgid "DatagramHandler" msgstr "DatagramHandler" -#: ../../library/logging.handlers.rst:545 +#: ../../library/logging.handlers.rst:562 msgid "" "The :class:`DatagramHandler` class, located in the :mod:`logging.handlers` " "module, inherits from :class:`SocketHandler` to support sending logging " "messages over UDP sockets." msgstr "" -#: ../../library/logging.handlers.rst:552 +#: ../../library/logging.handlers.rst:569 msgid "" "Returns a new instance of the :class:`DatagramHandler` class intended to " "communicate with a remote machine whose address is given by *host* and " "*port*." msgstr "" -#: ../../library/logging.handlers.rst:555 +#: ../../library/logging.handlers.rst:572 msgid "" "If ``port`` is specified as ``None``, a Unix domain socket is created using " "the value in ``host`` - otherwise, a UDP socket is created." msgstr "" -#: ../../library/logging.handlers.rst:561 +#: ../../library/logging.handlers.rst:578 msgid "" "Pickles the record's attribute dictionary and writes it to the socket in " "binary format. If there is an error with the socket, silently drops the " @@ -732,29 +756,29 @@ msgid "" "LogRecord`, use the :func:`~logging.makeLogRecord` function." msgstr "" -#: ../../library/logging.handlers.rst:570 +#: ../../library/logging.handlers.rst:587 msgid "" "The factory method of :class:`SocketHandler` is here overridden to create a " "UDP socket (:const:`socket.SOCK_DGRAM`)." msgstr "" -#: ../../library/logging.handlers.rst:576 +#: ../../library/logging.handlers.rst:593 msgid "" "Send a pickled byte-string to a socket. The format of the sent byte-string " "is as described in the documentation for :meth:`SocketHandler.makePickle`." msgstr "" -#: ../../library/logging.handlers.rst:583 +#: ../../library/logging.handlers.rst:600 msgid "SysLogHandler" msgstr "SysLogHandler" -#: ../../library/logging.handlers.rst:585 +#: ../../library/logging.handlers.rst:602 msgid "" "The :class:`SysLogHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a remote or local Unix syslog." msgstr "" -#: ../../library/logging.handlers.rst:591 +#: ../../library/logging.handlers.rst:608 msgid "" "Returns a new instance of the :class:`SysLogHandler` class intended to " "communicate with a remote Unix machine whose address is given by *address* " @@ -769,7 +793,7 @@ msgid "" "rsyslog), specify a value of :const:`socket.SOCK_STREAM`." msgstr "" -#: ../../library/logging.handlers.rst:603 +#: ../../library/logging.handlers.rst:620 msgid "" "Note that if your server is not listening on UDP port 514, :class:" "`SysLogHandler` may appear not to work. In that case, check what address you " @@ -780,21 +804,21 @@ msgid "" "platforms). On Windows, you pretty much have to use the UDP option." msgstr "" -#: ../../library/logging.handlers.rst:612 +#: ../../library/logging.handlers.rst:629 msgid "*socktype* was added." msgstr "新增 *socktype*\\ 。" -#: ../../library/logging.handlers.rst:618 +#: ../../library/logging.handlers.rst:635 msgid "Closes the socket to the remote host." msgstr "" -#: ../../library/logging.handlers.rst:623 +#: ../../library/logging.handlers.rst:640 msgid "" "The record is formatted, and then sent to the syslog server. If exception " "information is present, it is *not* sent to the server." msgstr "" -#: ../../library/logging.handlers.rst:626 +#: ../../library/logging.handlers.rst:643 msgid "" "(See: :issue:`12168`.) In earlier versions, the message sent to the syslog " "daemons was always terminated with a NUL byte, because early versions of " @@ -805,7 +829,7 @@ msgid "" "byte on as part of the message." msgstr "" -#: ../../library/logging.handlers.rst:635 +#: ../../library/logging.handlers.rst:652 msgid "" "To enable easier handling of syslog messages in the face of all these " "differing daemon behaviours, the appending of the NUL byte has been made " @@ -815,7 +839,7 @@ msgid "" "*not* append the NUL terminator." msgstr "" -#: ../../library/logging.handlers.rst:642 +#: ../../library/logging.handlers.rst:659 msgid "" "(See: :issue:`12419`.) In earlier versions, there was no facility for an " "\"ident\" or \"tag\" prefix to identify the source of the message. This can " @@ -826,262 +850,262 @@ msgid "" "bytes, and is prepended to the message exactly as is." msgstr "" -#: ../../library/logging.handlers.rst:653 +#: ../../library/logging.handlers.rst:670 msgid "" "Encodes the facility and priority into an integer. You can pass in strings " "or integers - if strings are passed, internal mapping dictionaries are used " "to convert them to integers." msgstr "" -#: ../../library/logging.handlers.rst:657 +#: ../../library/logging.handlers.rst:674 msgid "" "The symbolic ``LOG_`` values are defined in :class:`SysLogHandler` and " "mirror the values defined in the ``sys/syslog.h`` header file." msgstr "" -#: ../../library/logging.handlers.rst:660 +#: ../../library/logging.handlers.rst:677 msgid "**Priorities**" msgstr "" -#: ../../library/logging.handlers.rst:663 -#: ../../library/logging.handlers.rst:685 +#: ../../library/logging.handlers.rst:680 +#: ../../library/logging.handlers.rst:702 msgid "Name (string)" msgstr "" -#: ../../library/logging.handlers.rst:663 -#: ../../library/logging.handlers.rst:685 +#: ../../library/logging.handlers.rst:680 +#: ../../library/logging.handlers.rst:702 msgid "Symbolic value" msgstr "" -#: ../../library/logging.handlers.rst:665 +#: ../../library/logging.handlers.rst:682 msgid "``alert``" msgstr "``alert``" -#: ../../library/logging.handlers.rst:665 +#: ../../library/logging.handlers.rst:682 msgid "LOG_ALERT" msgstr "LOG_ALERT" -#: ../../library/logging.handlers.rst:667 +#: ../../library/logging.handlers.rst:684 msgid "``crit`` or ``critical``" msgstr "``crit`` 或 ``critical``" -#: ../../library/logging.handlers.rst:667 +#: ../../library/logging.handlers.rst:684 msgid "LOG_CRIT" msgstr "LOG_CRIT" -#: ../../library/logging.handlers.rst:669 +#: ../../library/logging.handlers.rst:686 msgid "``debug``" msgstr "``debug``" -#: ../../library/logging.handlers.rst:669 +#: ../../library/logging.handlers.rst:686 msgid "LOG_DEBUG" msgstr "LOG_DEBUG" -#: ../../library/logging.handlers.rst:671 +#: ../../library/logging.handlers.rst:688 msgid "``emerg`` or ``panic``" msgstr "``emerg`` 或 ``panic``" -#: ../../library/logging.handlers.rst:671 +#: ../../library/logging.handlers.rst:688 msgid "LOG_EMERG" msgstr "LOG_EMERG" -#: ../../library/logging.handlers.rst:673 +#: ../../library/logging.handlers.rst:690 msgid "``err`` or ``error``" msgstr "``err`` 或 ``error``" -#: ../../library/logging.handlers.rst:673 +#: ../../library/logging.handlers.rst:690 msgid "LOG_ERR" msgstr "LOG_ERR" -#: ../../library/logging.handlers.rst:675 +#: ../../library/logging.handlers.rst:692 msgid "``info``" msgstr "``info``" -#: ../../library/logging.handlers.rst:675 +#: ../../library/logging.handlers.rst:692 msgid "LOG_INFO" msgstr "LOG_INFO" -#: ../../library/logging.handlers.rst:677 +#: ../../library/logging.handlers.rst:694 msgid "``notice``" msgstr "``notice``" -#: ../../library/logging.handlers.rst:677 +#: ../../library/logging.handlers.rst:694 msgid "LOG_NOTICE" msgstr "LOG_NOTICE" -#: ../../library/logging.handlers.rst:679 +#: ../../library/logging.handlers.rst:696 msgid "``warn`` or ``warning``" msgstr "``warn`` 或 ``warning``" -#: ../../library/logging.handlers.rst:679 +#: ../../library/logging.handlers.rst:696 msgid "LOG_WARNING" msgstr "LOG_WARNING" -#: ../../library/logging.handlers.rst:682 +#: ../../library/logging.handlers.rst:699 msgid "**Facilities**" msgstr "" -#: ../../library/logging.handlers.rst:687 +#: ../../library/logging.handlers.rst:704 msgid "``auth``" msgstr "``auth``" -#: ../../library/logging.handlers.rst:687 +#: ../../library/logging.handlers.rst:704 msgid "LOG_AUTH" msgstr "LOG_AUTH" -#: ../../library/logging.handlers.rst:689 +#: ../../library/logging.handlers.rst:706 msgid "``authpriv``" msgstr "``authpriv``" -#: ../../library/logging.handlers.rst:689 +#: ../../library/logging.handlers.rst:706 msgid "LOG_AUTHPRIV" msgstr "LOG_AUTHPRIV" -#: ../../library/logging.handlers.rst:691 +#: ../../library/logging.handlers.rst:708 msgid "``cron``" msgstr "``cron``" -#: ../../library/logging.handlers.rst:691 +#: ../../library/logging.handlers.rst:708 msgid "LOG_CRON" msgstr "LOG_CRON" -#: ../../library/logging.handlers.rst:693 +#: ../../library/logging.handlers.rst:710 msgid "``daemon``" msgstr "``daemon``" -#: ../../library/logging.handlers.rst:693 +#: ../../library/logging.handlers.rst:710 msgid "LOG_DAEMON" msgstr "LOG_DAEMON" -#: ../../library/logging.handlers.rst:695 +#: ../../library/logging.handlers.rst:712 msgid "``ftp``" msgstr "``ftp``" -#: ../../library/logging.handlers.rst:695 +#: ../../library/logging.handlers.rst:712 msgid "LOG_FTP" msgstr "LOG_FTP" -#: ../../library/logging.handlers.rst:697 +#: ../../library/logging.handlers.rst:714 msgid "``kern``" msgstr "``kern``" -#: ../../library/logging.handlers.rst:697 +#: ../../library/logging.handlers.rst:714 msgid "LOG_KERN" msgstr "LOG_KERN" -#: ../../library/logging.handlers.rst:699 +#: ../../library/logging.handlers.rst:716 msgid "``lpr``" msgstr "``lpr``" -#: ../../library/logging.handlers.rst:699 +#: ../../library/logging.handlers.rst:716 msgid "LOG_LPR" msgstr "LOG_LPR" -#: ../../library/logging.handlers.rst:701 +#: ../../library/logging.handlers.rst:718 msgid "``mail``" msgstr "``mail``" -#: ../../library/logging.handlers.rst:701 +#: ../../library/logging.handlers.rst:718 msgid "LOG_MAIL" msgstr "LOG_MAIL" -#: ../../library/logging.handlers.rst:703 +#: ../../library/logging.handlers.rst:720 msgid "``news``" msgstr "``news``" -#: ../../library/logging.handlers.rst:703 +#: ../../library/logging.handlers.rst:720 msgid "LOG_NEWS" msgstr "LOG_NEWS" -#: ../../library/logging.handlers.rst:705 +#: ../../library/logging.handlers.rst:722 msgid "``syslog``" msgstr "``syslog``" -#: ../../library/logging.handlers.rst:705 +#: ../../library/logging.handlers.rst:722 msgid "LOG_SYSLOG" msgstr "LOG_SYSLOG" -#: ../../library/logging.handlers.rst:707 +#: ../../library/logging.handlers.rst:724 msgid "``user``" msgstr "``user``" -#: ../../library/logging.handlers.rst:707 +#: ../../library/logging.handlers.rst:724 msgid "LOG_USER" msgstr "LOG_USER" -#: ../../library/logging.handlers.rst:709 +#: ../../library/logging.handlers.rst:726 msgid "``uucp``" msgstr "``uucp``" -#: ../../library/logging.handlers.rst:709 +#: ../../library/logging.handlers.rst:726 msgid "LOG_UUCP" msgstr "LOG_UUCP" -#: ../../library/logging.handlers.rst:711 +#: ../../library/logging.handlers.rst:728 msgid "``local0``" msgstr "``local0``" -#: ../../library/logging.handlers.rst:711 +#: ../../library/logging.handlers.rst:728 msgid "LOG_LOCAL0" msgstr "LOG_LOCAL0" -#: ../../library/logging.handlers.rst:713 +#: ../../library/logging.handlers.rst:730 msgid "``local1``" msgstr "``local1``" -#: ../../library/logging.handlers.rst:713 +#: ../../library/logging.handlers.rst:730 msgid "LOG_LOCAL1" msgstr "LOG_LOCAL1" -#: ../../library/logging.handlers.rst:715 +#: ../../library/logging.handlers.rst:732 msgid "``local2``" msgstr "``local2``" -#: ../../library/logging.handlers.rst:715 +#: ../../library/logging.handlers.rst:732 msgid "LOG_LOCAL2" msgstr "LOG_LOCAL2" -#: ../../library/logging.handlers.rst:717 +#: ../../library/logging.handlers.rst:734 msgid "``local3``" msgstr "``local3``" -#: ../../library/logging.handlers.rst:717 +#: ../../library/logging.handlers.rst:734 msgid "LOG_LOCAL3" msgstr "LOG_LOCAL3" -#: ../../library/logging.handlers.rst:719 +#: ../../library/logging.handlers.rst:736 msgid "``local4``" msgstr "``local4``" -#: ../../library/logging.handlers.rst:719 +#: ../../library/logging.handlers.rst:736 msgid "LOG_LOCAL4" msgstr "LOG_LOCAL4" -#: ../../library/logging.handlers.rst:721 +#: ../../library/logging.handlers.rst:738 msgid "``local5``" msgstr "``local5``" -#: ../../library/logging.handlers.rst:721 +#: ../../library/logging.handlers.rst:738 msgid "LOG_LOCAL5" msgstr "LOG_LOCAL5" -#: ../../library/logging.handlers.rst:723 +#: ../../library/logging.handlers.rst:740 msgid "``local6``" msgstr "``local6``" -#: ../../library/logging.handlers.rst:723 +#: ../../library/logging.handlers.rst:740 msgid "LOG_LOCAL6" msgstr "LOG_LOCAL6" -#: ../../library/logging.handlers.rst:725 +#: ../../library/logging.handlers.rst:742 msgid "``local7``" msgstr "``local7``" -#: ../../library/logging.handlers.rst:725 +#: ../../library/logging.handlers.rst:742 msgid "LOG_LOCAL7" msgstr "LOG_LOCAL7" -#: ../../library/logging.handlers.rst:730 +#: ../../library/logging.handlers.rst:747 msgid "" "Maps a logging level name to a syslog priority name. You may need to " "override this if you are using custom levels, or if the default algorithm is " @@ -1090,11 +1114,11 @@ msgid "" "all other level names to 'warning'." msgstr "" -#: ../../library/logging.handlers.rst:740 +#: ../../library/logging.handlers.rst:757 msgid "NTEventLogHandler" msgstr "NTEventLogHandler" -#: ../../library/logging.handlers.rst:742 +#: ../../library/logging.handlers.rst:759 msgid "" "The :class:`NTEventLogHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a local Windows NT, Windows " @@ -1102,7 +1126,7 @@ msgid "" "Win32 extensions for Python installed." msgstr "" -#: ../../library/logging.handlers.rst:750 +#: ../../library/logging.handlers.rst:767 msgid "" "Returns a new instance of the :class:`NTEventLogHandler` class. The " "*appname* is used to define the application name as it appears in the event " @@ -1118,7 +1142,7 @@ msgid "" "or ``'Security'``, and defaults to ``'Application'``." msgstr "" -#: ../../library/logging.handlers.rst:766 +#: ../../library/logging.handlers.rst:783 msgid "" "At this point, you can remove the application name from the registry as a " "source of event log entries. However, if you do this, you will not be able " @@ -1127,19 +1151,19 @@ msgid "" "not do this." msgstr "" -#: ../../library/logging.handlers.rst:775 +#: ../../library/logging.handlers.rst:792 msgid "" "Determines the message ID, event category and event type, and then logs the " "message in the NT event log." msgstr "" -#: ../../library/logging.handlers.rst:781 +#: ../../library/logging.handlers.rst:798 msgid "" "Returns the event category for the record. Override this if you want to " "specify your own categories. This version returns 0." msgstr "" -#: ../../library/logging.handlers.rst:787 +#: ../../library/logging.handlers.rst:804 msgid "" "Returns the event type for the record. Override this if you want to specify " "your own types. This version does a mapping using the handler's typemap " @@ -1150,7 +1174,7 @@ msgid "" "the handler's *typemap* attribute." msgstr "" -#: ../../library/logging.handlers.rst:798 +#: ../../library/logging.handlers.rst:815 msgid "" "Returns the message ID for the record. If you are using your own messages, " "you could do this by having the *msg* passed to the logger being an ID " @@ -1159,17 +1183,17 @@ msgid "" "message ID in :file:`win32service.pyd`." msgstr "" -#: ../../library/logging.handlers.rst:807 +#: ../../library/logging.handlers.rst:824 msgid "SMTPHandler" msgstr "SMTPHandler" -#: ../../library/logging.handlers.rst:809 +#: ../../library/logging.handlers.rst:826 msgid "" "The :class:`SMTPHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to an email address via SMTP." msgstr "" -#: ../../library/logging.handlers.rst:815 +#: ../../library/logging.handlers.rst:832 msgid "" "Returns a new instance of the :class:`SMTPHandler` class. The instance is " "initialized with the from and to addresses and subject line of the email. " @@ -1180,7 +1204,7 @@ msgid "" "*credentials* argument." msgstr "" -#: ../../library/logging.handlers.rst:822 +#: ../../library/logging.handlers.rst:839 msgid "" "To specify the use of a secure protocol (TLS), pass in a tuple to the " "*secure* argument. This will only be used when authentication credentials " @@ -1190,31 +1214,31 @@ msgid "" "SMTP.starttls` method.)" msgstr "" -#: ../../library/logging.handlers.rst:829 +#: ../../library/logging.handlers.rst:846 msgid "" "A timeout can be specified for communication with the SMTP server using the " "*timeout* argument." msgstr "" -#: ../../library/logging.handlers.rst:832 +#: ../../library/logging.handlers.rst:849 msgid "The *timeout* argument was added." msgstr "新增 *timeout* 引數。" -#: ../../library/logging.handlers.rst:837 +#: ../../library/logging.handlers.rst:854 msgid "Formats the record and sends it to the specified addressees." msgstr "" -#: ../../library/logging.handlers.rst:842 +#: ../../library/logging.handlers.rst:859 msgid "" "If you want to specify a subject line which is record-dependent, override " "this method." msgstr "" -#: ../../library/logging.handlers.rst:848 +#: ../../library/logging.handlers.rst:865 msgid "MemoryHandler" msgstr "MemoryHandler" -#: ../../library/logging.handlers.rst:850 +#: ../../library/logging.handlers.rst:867 msgid "" "The :class:`MemoryHandler` class, located in the :mod:`logging.handlers` " "module, supports buffering of logging records in memory, periodically " @@ -1222,7 +1246,7 @@ msgid "" "buffer is full, or when an event of a certain severity or greater is seen." msgstr "" -#: ../../library/logging.handlers.rst:855 +#: ../../library/logging.handlers.rst:872 msgid "" ":class:`MemoryHandler` is a subclass of the more general :class:" "`BufferingHandler`, which is an abstract class. This buffers logging records " @@ -1231,31 +1255,31 @@ msgid "" "should, then :meth:`flush` is expected to do the flushing." msgstr "" -#: ../../library/logging.handlers.rst:864 +#: ../../library/logging.handlers.rst:881 msgid "" "Initializes the handler with a buffer of the specified capacity. Here, " "*capacity* means the number of logging records buffered." msgstr "" -#: ../../library/logging.handlers.rst:870 +#: ../../library/logging.handlers.rst:887 msgid "" "Append the record to the buffer. If :meth:`shouldFlush` returns true, call :" "meth:`flush` to process the buffer." msgstr "" -#: ../../library/logging.handlers.rst:876 +#: ../../library/logging.handlers.rst:893 msgid "" "You can override this to implement custom flushing behavior. This version " "just zaps the buffer to empty." msgstr "" -#: ../../library/logging.handlers.rst:882 +#: ../../library/logging.handlers.rst:899 msgid "" "Return ``True`` if the buffer is up to capacity. This method can be " "overridden to implement custom flushing strategies." msgstr "" -#: ../../library/logging.handlers.rst:888 +#: ../../library/logging.handlers.rst:905 msgid "" "Returns a new instance of the :class:`MemoryHandler` class. The instance is " "initialized with a buffer size of *capacity* (number of records buffered). " @@ -1267,41 +1291,41 @@ msgid "" "the buffer will occur when the handler is closed." msgstr "" -#: ../../library/logging.handlers.rst:897 +#: ../../library/logging.handlers.rst:914 msgid "The *flushOnClose* parameter was added." msgstr "新增 *flushOnClose* 參數。" -#: ../../library/logging.handlers.rst:903 +#: ../../library/logging.handlers.rst:920 msgid "Calls :meth:`flush`, sets the target to ``None`` and clears the buffer." msgstr "" -#: ../../library/logging.handlers.rst:909 +#: ../../library/logging.handlers.rst:926 msgid "" "For a :class:`MemoryHandler`, flushing means just sending the buffered " "records to the target, if there is one. The buffer is also cleared when this " "happens. Override if you want different behavior." msgstr "" -#: ../../library/logging.handlers.rst:916 +#: ../../library/logging.handlers.rst:933 msgid "Sets the target handler for this handler." msgstr "" -#: ../../library/logging.handlers.rst:921 +#: ../../library/logging.handlers.rst:938 msgid "Checks for buffer full or a record at the *flushLevel* or higher." msgstr "" -#: ../../library/logging.handlers.rst:927 +#: ../../library/logging.handlers.rst:944 msgid "HTTPHandler" msgstr "HTTPHandler" -#: ../../library/logging.handlers.rst:929 +#: ../../library/logging.handlers.rst:946 msgid "" "The :class:`HTTPHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a web server, using either " "``GET`` or ``POST`` semantics." msgstr "" -#: ../../library/logging.handlers.rst:936 +#: ../../library/logging.handlers.rst:953 msgid "" "Returns a new instance of the :class:`HTTPHandler` class. The *host* can be " "of the form ``host:port``, should you need to use a specific port number. " @@ -1315,11 +1339,11 @@ msgid "" "cleartext across the wire." msgstr "" -#: ../../library/logging.handlers.rst:947 +#: ../../library/logging.handlers.rst:964 msgid "The *context* parameter was added." msgstr "新增 *context* 參數。" -#: ../../library/logging.handlers.rst:952 +#: ../../library/logging.handlers.rst:969 msgid "" "Provides a dictionary, based on ``record``, which is to be URL-encoded and " "sent to the web server. The default implementation just returns ``record." @@ -1328,14 +1352,14 @@ msgid "" "customization of what's sent to the server is required." msgstr "" -#: ../../library/logging.handlers.rst:960 +#: ../../library/logging.handlers.rst:977 msgid "" "Sends the record to the web server as a URL-encoded dictionary. The :meth:" "`mapLogRecord` method is used to convert the record to the dictionary to be " "sent." msgstr "" -#: ../../library/logging.handlers.rst:964 +#: ../../library/logging.handlers.rst:981 msgid "" "Since preparing a record for sending it to a web server is not the same as a " "generic formatting operation, using :meth:`~logging.Handler.setFormatter` to " @@ -1345,18 +1369,18 @@ msgid "" "the dictionary in a form suitable for sending to a web server." msgstr "" -#: ../../library/logging.handlers.rst:977 +#: ../../library/logging.handlers.rst:994 msgid "QueueHandler" msgstr "QueueHandler" -#: ../../library/logging.handlers.rst:981 +#: ../../library/logging.handlers.rst:998 msgid "" "The :class:`QueueHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a queue, such as those " "implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: ../../library/logging.handlers.rst:985 +#: ../../library/logging.handlers.rst:1002 msgid "" "Along with the :class:`QueueListener` class, :class:`QueueHandler` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1366,7 +1390,7 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: ../../library/logging.handlers.rst:994 +#: ../../library/logging.handlers.rst:1011 msgid "" "Returns a new instance of the :class:`QueueHandler` class. The instance is " "initialized with the queue to send messages to. The *queue* can be any queue-" @@ -1376,7 +1400,7 @@ msgid "" "instances for *queue*." msgstr "" -#: ../../library/logging.handlers.rst:1004 +#: ../../library/logging.handlers.rst:1021 msgid "" "Enqueues the result of preparing the LogRecord. Should an exception occur (e." "g. because a bounded queue has filled up), the :meth:`~logging.Handler." @@ -1386,38 +1410,38 @@ msgid "" "raiseExceptions` is ``True``)." msgstr "" -#: ../../library/logging.handlers.rst:1013 +#: ../../library/logging.handlers.rst:1030 msgid "" "Prepares a record for queuing. The object returned by this method is " "enqueued." msgstr "" -#: ../../library/logging.handlers.rst:1016 +#: ../../library/logging.handlers.rst:1033 msgid "" "The base implementation formats the record to merge the message, arguments, " "and exception information, if present. It also removes unpickleable items " "from the record in-place." msgstr "" -#: ../../library/logging.handlers.rst:1020 +#: ../../library/logging.handlers.rst:1037 msgid "" "You might want to override this method if you want to convert the record to " "a dict or JSON string, or send a modified copy of the record while leaving " "the original intact." msgstr "" -#: ../../library/logging.handlers.rst:1026 +#: ../../library/logging.handlers.rst:1043 msgid "" "Enqueues the record on the queue using ``put_nowait()``; you may want to " "override this if you want to use blocking behaviour, or a timeout, or a " "customized queue implementation." msgstr "" -#: ../../library/logging.handlers.rst:1035 +#: ../../library/logging.handlers.rst:1052 msgid "QueueListener" msgstr "QueueListener" -#: ../../library/logging.handlers.rst:1039 +#: ../../library/logging.handlers.rst:1056 msgid "" "The :class:`QueueListener` class, located in the :mod:`logging.handlers` " "module, supports receiving logging messages from a queue, such as those " @@ -1428,7 +1452,7 @@ msgid "" "works hand-in-hand with :class:`QueueHandler`." msgstr "" -#: ../../library/logging.handlers.rst:1047 +#: ../../library/logging.handlers.rst:1064 msgid "" "Along with the :class:`QueueHandler` class, :class:`QueueListener` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1438,7 +1462,7 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: ../../library/logging.handlers.rst:1056 +#: ../../library/logging.handlers.rst:1073 msgid "" "Returns a new instance of the :class:`QueueListener` class. The instance is " "initialized with the queue to send messages to and a list of handlers which " @@ -1449,7 +1473,7 @@ msgid "" "class:`~queue.SimpleQueue` instances for *queue*." msgstr "" -#: ../../library/logging.handlers.rst:1064 +#: ../../library/logging.handlers.rst:1081 msgid "" "If ``respect_handler_level`` is ``True``, a handler's level is respected " "(compared with the level for the message) when deciding whether to pass " @@ -1457,82 +1481,82 @@ msgid "" "versions - to always pass each message to each handler." msgstr "" -#: ../../library/logging.handlers.rst:1069 +#: ../../library/logging.handlers.rst:1086 msgid "The ``respect_handler_level`` argument was added." msgstr "新增 ``respect_handler_level`` 引數。" -#: ../../library/logging.handlers.rst:1074 +#: ../../library/logging.handlers.rst:1091 msgid "Dequeues a record and return it, optionally blocking." msgstr "" -#: ../../library/logging.handlers.rst:1076 +#: ../../library/logging.handlers.rst:1093 msgid "" "The base implementation uses ``get()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1082 +#: ../../library/logging.handlers.rst:1099 msgid "Prepare a record for handling." msgstr "" -#: ../../library/logging.handlers.rst:1084 +#: ../../library/logging.handlers.rst:1101 msgid "" "This implementation just returns the passed-in record. You may want to " "override this method if you need to do any custom marshalling or " "manipulation of the record before passing it to the handlers." msgstr "" -#: ../../library/logging.handlers.rst:1090 +#: ../../library/logging.handlers.rst:1107 msgid "Handle a record." msgstr "" -#: ../../library/logging.handlers.rst:1092 +#: ../../library/logging.handlers.rst:1109 msgid "" "This just loops through the handlers offering them the record to handle. The " "actual object passed to the handlers is that which is returned from :meth:" "`prepare`." msgstr "" -#: ../../library/logging.handlers.rst:1098 +#: ../../library/logging.handlers.rst:1115 msgid "Starts the listener." msgstr "" -#: ../../library/logging.handlers.rst:1100 +#: ../../library/logging.handlers.rst:1117 msgid "" "This starts up a background thread to monitor the queue for LogRecords to " "process." msgstr "" -#: ../../library/logging.handlers.rst:1105 +#: ../../library/logging.handlers.rst:1122 msgid "Stops the listener." msgstr "" -#: ../../library/logging.handlers.rst:1107 +#: ../../library/logging.handlers.rst:1124 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: ../../library/logging.handlers.rst:1113 +#: ../../library/logging.handlers.rst:1130 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1124 +#: ../../library/logging.handlers.rst:1141 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.handlers.rst:1124 +#: ../../library/logging.handlers.rst:1141 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.handlers.rst:1126 +#: ../../library/logging.handlers.rst:1143 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.handlers.rst:1127 +#: ../../library/logging.handlers.rst:1144 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/zipimport.po b/library/zipimport.po index aa7439339f..87793fd266 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2021-12-16 19:25+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,12 +48,12 @@ msgstr "" #: ../../library/zipimport.rst:26 msgid "" -"Any files may be present in the ZIP archive, but only files :file:`.py` and :" -"file:`.pyc` are available for import. ZIP import of dynamic modules (:file:" -"`.pyd`, :file:`.so`) is disallowed. Note that if an archive only contains :" -"file:`.py` files, Python will not attempt to modify the archive by adding " -"the corresponding :file:`.pyc` file, meaning that if a ZIP archive doesn't " -"contain :file:`.pyc` files, importing may be rather slow." +"Any files may be present in the ZIP archive, but importers are only invoked " +"for :file:`.py` and :file:`.pyc` files. ZIP import of dynamic modules (:" +"file:`.pyd`, :file:`.so`) is disallowed. Note that if an archive only " +"contains :file:`.py` files, Python will not attempt to modify the archive by " +"adding the corresponding :file:`.pyc` file, meaning that if a ZIP archive " +"doesn't contain :file:`.pyc` files, importing may be rather slow." msgstr "" #: ../../library/zipimport.rst:33 diff --git a/reference/datamodel.po b/reference/datamodel.po index 4a13e60951..5337067a9a 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-12-11 00:08+0000\n" +"POT-Creation-Date: 2021-12-14 00:10+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -222,7 +222,8 @@ msgstr "" #: ../../reference/datamodel.rst:190 msgid "" "The string representations of the numeric classes, computed by :meth:" -"`__repr__` and :meth:`__str__`, have the following properties:" +"`~object.__repr__` and :meth:`~object.__str__`, have the following " +"properties:" msgstr "" #: ../../reference/datamodel.rst:194 @@ -576,7 +577,7 @@ msgid "" "implementation detail at that time rather than a language guarantee." msgstr "" -#: ../../reference/datamodel.rst:725 +#: ../../reference/datamodel.rst:726 msgid "Callable types" msgstr "" @@ -597,7 +598,7 @@ msgid "" "containing the same number of items as the function's formal parameter list." msgstr "" -#: ../../reference/datamodel.rst:487 ../../reference/datamodel.rst:840 +#: ../../reference/datamodel.rst:487 ../../reference/datamodel.rst:841 msgid "Special attributes:" msgstr "" @@ -609,8 +610,8 @@ msgstr "屬性" msgid "Meaning" msgstr "" -#: ../../reference/datamodel.rst:507 ../../reference/datamodel.rst:761 -#: ../../reference/datamodel.rst:856 +#: ../../reference/datamodel.rst:507 ../../reference/datamodel.rst:762 +#: ../../reference/datamodel.rst:857 msgid ":attr:`__doc__`" msgstr ":attr:`__doc__`" @@ -644,7 +645,7 @@ msgstr ":attr:`~definition.\\ __qualname__`" msgid "The function's :term:`qualified name`." msgstr "" -#: ../../reference/datamodel.rst:520 ../../reference/datamodel.rst:846 +#: ../../reference/datamodel.rst:520 ../../reference/datamodel.rst:847 msgid ":attr:`__module__`" msgstr ":attr:`__module__`" @@ -686,7 +687,7 @@ msgstr "" msgid "Read-only" msgstr "" -#: ../../reference/datamodel.rst:540 ../../reference/datamodel.rst:849 +#: ../../reference/datamodel.rst:540 ../../reference/datamodel.rst:850 msgid ":attr:`~object.__dict__`" msgstr ":attr:`~object.__dict__`" @@ -704,8 +705,8 @@ msgid "" "variables. See below for information on the ``cell_contents`` attribute." msgstr "" -#: ../../reference/datamodel.rst:551 ../../reference/datamodel.rst:776 -#: ../../reference/datamodel.rst:863 +#: ../../reference/datamodel.rst:551 ../../reference/datamodel.rst:777 +#: ../../reference/datamodel.rst:864 msgid ":attr:`__annotations__`" msgstr ":attr:`__annotations__`" @@ -863,7 +864,7 @@ msgid "" "ref:`coroutine-objects` section." msgstr "" -#: ../../reference/datamodel.rst:686 +#: ../../reference/datamodel.rst:687 msgid "Asynchronous generator functions" msgstr "" @@ -878,19 +879,20 @@ msgstr "" #: ../../reference/datamodel.rst:680 msgid "" -"Calling the asynchronous iterator's :meth:`aiterator.__anext__` method will " -"return an :term:`awaitable` which when awaited will execute until it " -"provides a value using the :keyword:`yield` expression. When the function " -"executes an empty :keyword:`return` statement or falls off the end, a :exc:" -"`StopAsyncIteration` exception is raised and the asynchronous iterator will " -"have reached the end of the set of values to be yielded." +"Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " +"execute until it provides a value using the :keyword:`yield` expression. " +"When the function executes an empty :keyword:`return` statement or falls off " +"the end, a :exc:`StopAsyncIteration` exception is raised and the " +"asynchronous iterator will have reached the end of the set of values to be " +"yielded." msgstr "" -#: ../../reference/datamodel.rst:701 +#: ../../reference/datamodel.rst:702 msgid "Built-in functions" msgstr "" -#: ../../reference/datamodel.rst:694 +#: ../../reference/datamodel.rst:695 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " @@ -902,11 +904,11 @@ msgid "" "module the function was defined in or ``None`` if unavailable." msgstr "" -#: ../../reference/datamodel.rst:713 +#: ../../reference/datamodel.rst:714 msgid "Built-in methods" msgstr "" -#: ../../reference/datamodel.rst:709 +#: ../../reference/datamodel.rst:710 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -915,34 +917,34 @@ msgid "" "attr:`__self__` is set to the object denoted by *alist*." msgstr "" -#: ../../reference/datamodel.rst:720 +#: ../../reference/datamodel.rst:721 msgid "Classes" msgstr "" -#: ../../reference/datamodel.rst:716 +#: ../../reference/datamodel.rst:717 msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " -"override :meth:`__new__`. The arguments of the call are passed to :meth:" -"`__new__` and, in the typical case, to :meth:`__init__` to initialize the " -"new instance." +"override :meth:`~object.__new__`. The arguments of the call are passed to :" +"meth:`__new__` and, in the typical case, to :meth:`~object.__init__` to " +"initialize the new instance." msgstr "" -#: ../../reference/datamodel.rst:725 +#: ../../reference/datamodel.rst:726 msgid "Class Instances" msgstr "" -#: ../../reference/datamodel.rst:723 +#: ../../reference/datamodel.rst:724 msgid "" "Instances of arbitrary classes can be made callable by defining a :meth:" -"`__call__` method in their class." +"`~object.__call__` method in their class." msgstr "" -#: ../../reference/datamodel.rst:788 +#: ../../reference/datamodel.rst:789 msgid "Modules" msgstr "模組" -#: ../../reference/datamodel.rst:732 +#: ../../reference/datamodel.rst:733 msgid "" "Modules are a basic organizational unit of Python code, and are created by " "the :ref:`import system ` as invoked either by the :keyword:" @@ -956,33 +958,33 @@ msgid "" "needed once the initialization is done)." msgstr "" -#: ../../reference/datamodel.rst:744 +#: ../../reference/datamodel.rst:745 msgid "" "Attribute assignment updates the module's namespace dictionary, e.g., ``m.x " "= 1`` is equivalent to ``m.__dict__[\"x\"] = 1``." msgstr "" -#: ../../reference/datamodel.rst:754 +#: ../../reference/datamodel.rst:755 msgid "Predefined (writable) attributes:" msgstr "" -#: ../../reference/datamodel.rst:757 +#: ../../reference/datamodel.rst:758 msgid ":attr:`__name__`" msgstr ":attr:`__name__`" -#: ../../reference/datamodel.rst:757 +#: ../../reference/datamodel.rst:758 msgid "The module's name." msgstr "" -#: ../../reference/datamodel.rst:760 +#: ../../reference/datamodel.rst:761 msgid "The module's documentation string, or ``None`` if unavailable." msgstr "" -#: ../../reference/datamodel.rst:770 +#: ../../reference/datamodel.rst:771 msgid ":attr:`__file__`" msgstr ":attr:`__file__`" -#: ../../reference/datamodel.rst:764 +#: ../../reference/datamodel.rst:765 msgid "" "The pathname of the file from which the module was loaded, if it was loaded " "from a file. The :attr:`__file__` attribute may be missing for certain types " @@ -991,20 +993,20 @@ msgid "" "library, it's the pathname of the shared library file." msgstr "" -#: ../../reference/datamodel.rst:773 +#: ../../reference/datamodel.rst:774 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during module body execution. For best practices on working with :" "attr:`__annotations__`, please see :ref:`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:780 +#: ../../reference/datamodel.rst:781 msgid "" "Special read-only attribute: :attr:`~object.__dict__` is the module's " "namespace as a dictionary object." msgstr "" -#: ../../reference/datamodel.rst:785 +#: ../../reference/datamodel.rst:786 msgid "" "Because of the way CPython clears module dictionaries, the module dictionary " "will be cleared when the module falls out of scope even if the dictionary " @@ -1012,11 +1014,11 @@ msgid "" "module around while using its dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:863 +#: ../../reference/datamodel.rst:864 msgid "Custom classes" msgstr "" -#: ../../reference/datamodel.rst:791 +#: ../../reference/datamodel.rst:792 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1032,7 +1034,7 @@ msgid "" "python.org/download/releases/2.3/mro/." msgstr "" -#: ../../reference/datamodel.rst:815 +#: ../../reference/datamodel.rst:816 msgid "" "When a class attribute reference (for class :class:`C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1043,60 +1045,60 @@ msgid "" "in its :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:825 +#: ../../reference/datamodel.rst:826 msgid "" "Class attribute assignments update the class's dictionary, never the " "dictionary of a base class." msgstr "" -#: ../../reference/datamodel.rst:830 +#: ../../reference/datamodel.rst:831 msgid "" "A class object can be called (see above) to yield a class instance (see " "below)." msgstr "" -#: ../../reference/datamodel.rst:843 +#: ../../reference/datamodel.rst:844 msgid ":attr:`~definition.__name__`" msgstr ":attr:`~definition.__name__`" -#: ../../reference/datamodel.rst:843 +#: ../../reference/datamodel.rst:844 msgid "The class name." msgstr "" -#: ../../reference/datamodel.rst:846 +#: ../../reference/datamodel.rst:847 msgid "The name of the module in which the class was defined." msgstr "" -#: ../../reference/datamodel.rst:849 +#: ../../reference/datamodel.rst:850 msgid "The dictionary containing the class's namespace." msgstr "" -#: ../../reference/datamodel.rst:853 +#: ../../reference/datamodel.rst:854 msgid ":attr:`~class.__bases__`" msgstr ":attr:`~class.__bases__`" -#: ../../reference/datamodel.rst:852 +#: ../../reference/datamodel.rst:853 msgid "" "A tuple containing the base classes, in the order of their occurrence in the " "base class list." msgstr "" -#: ../../reference/datamodel.rst:856 +#: ../../reference/datamodel.rst:857 msgid "The class's documentation string, or ``None`` if undefined." msgstr "" -#: ../../reference/datamodel.rst:859 +#: ../../reference/datamodel.rst:860 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during class body execution. For best practices on working with :" "attr:`__annotations__`, please see :ref:`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:906 +#: ../../reference/datamodel.rst:907 msgid "Class instances" msgstr "" -#: ../../reference/datamodel.rst:872 +#: ../../reference/datamodel.rst:873 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1109,35 +1111,35 @@ msgid "" "\"Classes\". See section :ref:`descriptors` for another way in which " "attributes of a class retrieved via its instances may differ from the " "objects actually stored in the class's :attr:`~object.__dict__`. If no " -"class attribute is found, and the object's class has a :meth:`__getattr__` " -"method, that is called to satisfy the lookup." +"class attribute is found, and the object's class has a :meth:`~object." +"__getattr__` method, that is called to satisfy the lookup." msgstr "" -#: ../../reference/datamodel.rst:888 +#: ../../reference/datamodel.rst:889 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " -"a class's dictionary. If the class has a :meth:`__setattr__` or :meth:" -"`__delattr__` method, this is called instead of updating the instance " -"dictionary directly." +"a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" +"meth:`~object.__delattr__` method, this is called instead of updating the " +"instance dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:898 +#: ../../reference/datamodel.rst:899 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" -#: ../../reference/datamodel.rst:905 +#: ../../reference/datamodel.rst:906 msgid "" "Special attributes: :attr:`~object.__dict__` is the attribute dictionary; :" "attr:`~instance.__class__` is the instance's class." msgstr "" -#: ../../reference/datamodel.rst:932 +#: ../../reference/datamodel.rst:933 msgid "I/O objects (also known as file objects)" msgstr "" -#: ../../reference/datamodel.rst:922 +#: ../../reference/datamodel.rst:923 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1146,7 +1148,7 @@ msgid "" "methods provided by extension modules)." msgstr "" -#: ../../reference/datamodel.rst:928 +#: ../../reference/datamodel.rst:929 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " @@ -1154,22 +1156,22 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1182 +#: ../../reference/datamodel.rst:1184 msgid "Internal types" msgstr "" -#: ../../reference/datamodel.rst:939 +#: ../../reference/datamodel.rst:940 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1014 +#: ../../reference/datamodel.rst:1015 msgid "Code objects" msgstr "" -#: ../../reference/datamodel.rst:946 +#: ../../reference/datamodel.rst:947 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1181,7 +1183,7 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:973 +#: ../../reference/datamodel.rst:974 msgid "" "Special read-only attributes: :attr:`co_name` gives the function name; :attr:" "`co_argcount` is the total number of positional arguments (including " @@ -1205,7 +1207,7 @@ msgid "" "`co_flags` is an integer encoding a number of flags for the interpreter." msgstr "" -#: ../../reference/datamodel.rst:997 +#: ../../reference/datamodel.rst:998 msgid "" "The following flag bits are defined for :attr:`co_flags`: bit ``0x04`` is " "set if the function uses the ``*arguments`` syntax to accept an arbitrary " @@ -1214,7 +1216,7 @@ msgid "" "set if the function is a generator." msgstr "" -#: ../../reference/datamodel.rst:1003 +#: ../../reference/datamodel.rst:1004 msgid "" "Future feature declarations (``from __future__ import division``) also use " "bits in :attr:`co_flags` to indicate whether a code object was compiled with " @@ -1223,27 +1225,27 @@ msgid "" "used in earlier versions of Python." msgstr "" -#: ../../reference/datamodel.rst:1009 +#: ../../reference/datamodel.rst:1010 msgid "Other bits in :attr:`co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1013 +#: ../../reference/datamodel.rst:1014 msgid "" "If a code object represents a function, the first item in :attr:`co_consts` " "is the documentation string of the function, or ``None`` if undefined." msgstr "" -#: ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:1077 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1021 +#: ../../reference/datamodel.rst:1022 msgid "" "Frame objects represent execution frames. They may occur in traceback " "objects (see below), and are also passed to registered trace functions." msgstr "" -#: ../../reference/datamodel.rst:1032 +#: ../../reference/datamodel.rst:1033 msgid "" "Special read-only attributes: :attr:`f_back` is to the previous stack frame " "(towards the caller), or ``None`` if this is the bottom stack frame; :attr:" @@ -1254,13 +1256,13 @@ msgid "" "the bytecode string of the code object)." msgstr "" -#: ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:1041 msgid "" "Accessing ``f_code`` raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" -#: ../../reference/datamodel.rst:1049 +#: ../../reference/datamodel.rst:1050 msgid "" "Special writable attributes: :attr:`f_trace`, if not ``None``, is a function " "called for various events during code execution (this is used by the " @@ -1268,7 +1270,7 @@ msgid "" "can be disabled by setting :attr:`f_trace_lines` to :const:`False`." msgstr "" -#: ../../reference/datamodel.rst:1054 +#: ../../reference/datamodel.rst:1055 msgid "" "Implementations *may* allow per-opcode events to be requested by setting :" "attr:`f_trace_opcodes` to :const:`True`. Note that this may lead to " @@ -1276,7 +1278,7 @@ msgid "" "escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1060 msgid "" ":attr:`f_lineno` is the current line number of the frame --- writing to this " "from within a trace function jumps to the given line (only for the bottom-" @@ -1284,11 +1286,11 @@ msgid "" "Statement) by writing to f_lineno." msgstr "" -#: ../../reference/datamodel.rst:1064 +#: ../../reference/datamodel.rst:1065 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1068 +#: ../../reference/datamodel.rst:1069 msgid "" "This method clears all references to local variables held by the frame. " "Also, if the frame belonged to a generator, the generator is finalized. " @@ -1296,22 +1298,22 @@ msgid "" "catching an exception and storing its traceback for later use)." msgstr "" -#: ../../reference/datamodel.rst:1074 +#: ../../reference/datamodel.rst:1075 msgid ":exc:`RuntimeError` is raised if the frame is currently executing." msgstr "" -#: ../../reference/datamodel.rst:1139 +#: ../../reference/datamodel.rst:1140 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1091 +#: ../../reference/datamodel.rst:1092 msgid "" "Traceback objects represent a stack trace of an exception. A traceback " "object is implicitly created when an exception occurs, and may also be " "explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1095 +#: ../../reference/datamodel.rst:1096 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1321,21 +1323,21 @@ msgid "" "exc_info()``, and as the ``__traceback__`` attribute of the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1103 +#: ../../reference/datamodel.rst:1104 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " "interactive, it is also made available to the user as ``sys.last_traceback``." msgstr "" -#: ../../reference/datamodel.rst:1108 +#: ../../reference/datamodel.rst:1109 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the ``tb_next`` attributes should be linked to form a full " "stack trace." msgstr "" -#: ../../reference/datamodel.rst:1118 +#: ../../reference/datamodel.rst:1119 msgid "" "Special read-only attributes: :attr:`tb_frame` points to the execution frame " "of the current level; :attr:`tb_lineno` gives the line number where the " @@ -1345,47 +1347,47 @@ msgid "" "statement with no matching except clause or with a finally clause." msgstr "" -#: ../../reference/datamodel.rst:1127 +#: ../../reference/datamodel.rst:1128 msgid "" "Accessing ``tb_frame`` raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" -#: ../../reference/datamodel.rst:1133 +#: ../../reference/datamodel.rst:1134 msgid "" "Special writable attribute: :attr:`tb_next` is the next level in the stack " "trace (towards the frame where the exception occurred), or ``None`` if there " "is no next level." msgstr "" -#: ../../reference/datamodel.rst:1137 +#: ../../reference/datamodel.rst:1138 msgid "" "Traceback objects can now be explicitly instantiated from Python code, and " "the ``tb_next`` attribute of existing instances can be updated." msgstr "" -#: ../../reference/datamodel.rst:1165 +#: ../../reference/datamodel.rst:1167 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1144 +#: ../../reference/datamodel.rst:1145 msgid "" -"Slice objects are used to represent slices for :meth:`__getitem__` methods. " -"They are also created by the built-in :func:`slice` function." +"Slice objects are used to represent slices for :meth:`~object.__getitem__` " +"methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1152 +#: ../../reference/datamodel.rst:1154 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1156 +#: ../../reference/datamodel.rst:1158 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1160 +#: ../../reference/datamodel.rst:1162 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1395,11 +1397,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1174 +#: ../../reference/datamodel.rst:1176 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1168 +#: ../../reference/datamodel.rst:1170 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1410,11 +1412,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1182 +#: ../../reference/datamodel.rst:1184 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:1179 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1423,34 +1425,34 @@ msgid "" "objects are created by the built-in :func:`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1187 +#: ../../reference/datamodel.rst:1189 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1193 +#: ../../reference/datamodel.rst:1195 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " "methods with special names. This is Python's approach to :dfn:`operator " "overloading`, allowing classes to define their own behavior with respect to " "language operators. For instance, if a class defines a method named :meth:" -"`__getitem__`, and ``x`` is an instance of this class, then ``x[i]`` is " -"roughly equivalent to ``type(x).__getitem__(x, i)``. Except where " +"`~object.__getitem__`, and ``x`` is an instance of this class, then ``x[i]`` " +"is roughly equivalent to ``type(x).__getitem__(x, i)``. Except where " "mentioned, attempts to execute an operation raise an exception when no " "appropriate method is defined (typically :exc:`AttributeError` or :exc:" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1203 +#: ../../reference/datamodel.rst:1206 msgid "" "Setting a special method to ``None`` indicates that the corresponding " -"operation is not available. For example, if a class sets :meth:`__iter__` " -"to ``None``, the class is not iterable, so calling :func:`iter` on its " -"instances will raise a :exc:`TypeError` (without falling back to :meth:" -"`__getitem__`). [#]_" +"operation is not available. For example, if a class sets :meth:`~object." +"__iter__` to ``None``, the class is not iterable, so calling :func:`iter` on " +"its instances will raise a :exc:`TypeError` (without falling back to :meth:" +"`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1209 +#: ../../reference/datamodel.rst:1212 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -1460,11 +1462,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1220 +#: ../../reference/datamodel.rst:1223 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1226 +#: ../../reference/datamodel.rst:1229 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1474,7 +1476,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1233 +#: ../../reference/datamodel.rst:1236 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -1482,7 +1484,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1238 +#: ../../reference/datamodel.rst:1241 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1491,13 +1493,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1243 +#: ../../reference/datamodel.rst:1246 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1246 +#: ../../reference/datamodel.rst:1249 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -1505,7 +1507,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1255 +#: ../../reference/datamodel.rst:1258 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1515,7 +1517,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1262 +#: ../../reference/datamodel.rst:1265 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -1523,7 +1525,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1275 +#: ../../reference/datamodel.rst:1278 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1532,7 +1534,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1281 +#: ../../reference/datamodel.rst:1284 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1542,31 +1544,31 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1288 +#: ../../reference/datamodel.rst:1291 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits." msgstr "" -#: ../../reference/datamodel.rst:1293 +#: ../../reference/datamodel.rst:1296 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1308 +#: ../../reference/datamodel.rst:1311 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1312 +#: ../../reference/datamodel.rst:1315 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1316 +#: ../../reference/datamodel.rst:1319 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1575,7 +1577,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1322 +#: ../../reference/datamodel.rst:1325 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -1586,7 +1588,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1337 +#: ../../reference/datamodel.rst:1340 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -1598,13 +1600,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1346 +#: ../../reference/datamodel.rst:1349 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1357 +#: ../../reference/datamodel.rst:1360 msgid "" "Called by :func:`str(object) ` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -1612,26 +1614,26 @@ msgid "" "` object." msgstr "" -#: ../../reference/datamodel.rst:1362 +#: ../../reference/datamodel.rst:1365 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1366 +#: ../../reference/datamodel.rst:1369 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1376 +#: ../../reference/datamodel.rst:1379 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1387 +#: ../../reference/datamodel.rst:1390 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -1643,28 +1645,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1397 +#: ../../reference/datamodel.rst:1400 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1399 +#: ../../reference/datamodel.rst:1402 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1401 +#: ../../reference/datamodel.rst:1404 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1405 +#: ../../reference/datamodel.rst:1408 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1421 +#: ../../reference/datamodel.rst:1424 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1510 +#: ../../reference/datamodel.rst:1513 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -1783,7 +1785,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1519 +#: ../../reference/datamodel.rst:1522 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are \"salted" "\" with an unpredictable random value. Although they remain constant within " @@ -1791,7 +1793,7 @@ msgid "" "invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1524 +#: ../../reference/datamodel.rst:1527 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully-chosen inputs that exploit the worst case performance of a dict " @@ -1799,22 +1801,22 @@ msgid "" "ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1529 +#: ../../reference/datamodel.rst:1532 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1533 +#: ../../reference/datamodel.rst:1536 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`\\ 。" -#: ../../reference/datamodel.rst:1535 +#: ../../reference/datamodel.rst:1538 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1543 +#: ../../reference/datamodel.rst:1546 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -1823,18 +1825,18 @@ msgid "" "`__len__` nor :meth:`__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:1554 +#: ../../reference/datamodel.rst:1557 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:1556 +#: ../../reference/datamodel.rst:1559 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:1564 +#: ../../reference/datamodel.rst:1567 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -1844,7 +1846,7 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1571 +#: ../../reference/datamodel.rst:1574 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -1857,7 +1859,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:1584 +#: ../../reference/datamodel.rst:1587 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -1869,82 +1871,82 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:1595 +#: ../../reference/datamodel.rst:1598 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or built-in functions. " "See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:1599 +#: ../../reference/datamodel.rst:1602 msgid "" "Raises an :ref:`auditing event ` ``object.__getattr__`` with " "arguments ``obj``, ``name``." msgstr "" -#: ../../reference/datamodel.rst:1601 +#: ../../reference/datamodel.rst:1604 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1608 +#: ../../reference/datamodel.rst:1611 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:1612 +#: ../../reference/datamodel.rst:1615 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:1616 +#: ../../reference/datamodel.rst:1619 msgid "" "Raises an :ref:`auditing event ` ``object.__setattr__`` with " "arguments ``obj``, ``name``, ``value``." msgstr "" -#: ../../reference/datamodel.rst:1618 +#: ../../reference/datamodel.rst:1621 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:1625 +#: ../../reference/datamodel.rst:1628 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:1628 +#: ../../reference/datamodel.rst:1631 msgid "" "Raises an :ref:`auditing event ` ``object.__delattr__`` with " "arguments ``obj``, ``name``." msgstr "" -#: ../../reference/datamodel.rst:1630 +#: ../../reference/datamodel.rst:1633 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1637 +#: ../../reference/datamodel.rst:1640 msgid "" "Called when :func:`dir` is called on the object. A sequence must be " "returned. :func:`dir` converts the returned sequence to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:1642 +#: ../../reference/datamodel.rst:1645 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:1649 +#: ../../reference/datamodel.rst:1652 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -1956,21 +1958,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:1658 +#: ../../reference/datamodel.rst:1661 msgid "" "The ``__dir__`` function should accept no arguments, and return a sequence " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:1662 +#: ../../reference/datamodel.rst:1665 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:1680 +#: ../../reference/datamodel.rst:1683 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -1978,27 +1980,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:1685 +#: ../../reference/datamodel.rst:1688 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:1688 +#: ../../reference/datamodel.rst:1691 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:1693 +#: ../../reference/datamodel.rst:1696 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:1694 +#: ../../reference/datamodel.rst:1697 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:1700 +#: ../../reference/datamodel.rst:1703 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:1702 +#: ../../reference/datamodel.rst:1705 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2008,7 +2010,7 @@ msgid "" "owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:1712 +#: ../../reference/datamodel.rst:1715 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2017,13 +2019,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:1718 +#: ../../reference/datamodel.rst:1721 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1721 +#: ../../reference/datamodel.rst:1724 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2033,25 +2035,25 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:1730 +#: ../../reference/datamodel.rst:1733 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:1733 +#: ../../reference/datamodel.rst:1736 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:1739 +#: ../../reference/datamodel.rst:1742 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1745 msgid "" "The attribute :attr:`__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2062,19 +2064,20 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:1753 +#: ../../reference/datamodel.rst:1756 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1758 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " -"protocol: :meth:`__get__`, :meth:`__set__`, and :meth:`__delete__`. If any " -"of those methods are defined for an object, it is said to be a descriptor." +"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, and :meth:" +"`~object.__delete__`. If any of those methods are defined for an object, it " +"is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:1760 +#: ../../reference/datamodel.rst:1764 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2082,7 +2085,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:1765 +#: ../../reference/datamodel.rst:1769 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2090,47 +2093,47 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:1770 +#: ../../reference/datamodel.rst:1774 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:1775 +#: ../../reference/datamodel.rst:1779 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:1774 +#: ../../reference/datamodel.rst:1778 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:1779 +#: ../../reference/datamodel.rst:1783 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:1778 +#: ../../reference/datamodel.rst:1782 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:1783 +#: ../../reference/datamodel.rst:1787 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:1782 +#: ../../reference/datamodel.rst:1786 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:1789 +#: ../../reference/datamodel.rst:1793 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:1786 +#: ../../reference/datamodel.rst:1790 msgid "" "If ``a`` is an instance of :class:`super`, then the binding ``super(B, obj)." "m()`` searches ``obj.__class__.__mro__`` for the base class ``A`` " @@ -2138,107 +2141,109 @@ msgid "" "``A.__dict__['m'].__get__(obj, obj.__class__)``." msgstr "" -#: ../../reference/datamodel.rst:1791 +#: ../../reference/datamodel.rst:1795 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " -"combination of :meth:`__get__`, :meth:`__set__` and :meth:`__delete__`. If " -"it does not define :meth:`__get__`, then accessing the attribute will return " -"the descriptor object itself unless there is a value in the object's " -"instance dictionary. If the descriptor defines :meth:`__set__` and/or :meth:" -"`__delete__`, it is a data descriptor; if it defines neither, it is a non-" -"data descriptor. Normally, data descriptors define both :meth:`__get__` " -"and :meth:`__set__`, while non-data descriptors have just the :meth:" -"`__get__` method. Data descriptors with :meth:`__get__` and :meth:`__set__` " -"(and/or :meth:`__delete__`) defined always override a redefinition in an " -"instance dictionary. In contrast, non-data descriptors can be overridden by " -"instances." +"combination of :meth:`~object.__get__`, :meth:`~object.__set__` and :meth:" +"`~object.__delete__`. If it does not define :meth:`__get__`, then accessing " +"the attribute will return the descriptor object itself unless there is a " +"value in the object's instance dictionary. If the descriptor defines :meth:" +"`__set__` and/or :meth:`__delete__`, it is a data descriptor; if it defines " +"neither, it is a non-data descriptor. Normally, data descriptors define " +"both :meth:`__get__` and :meth:`__set__`, while non-data descriptors have " +"just the :meth:`__get__` method. Data descriptors with :meth:`__get__` and :" +"meth:`__set__` (and/or :meth:`__delete__`) defined always override a " +"redefinition in an instance dictionary. In contrast, non-data descriptors " +"can be overridden by instances." msgstr "" -#: ../../reference/datamodel.rst:1804 +#: ../../reference/datamodel.rst:1809 msgid "" -"Python methods (including :func:`staticmethod` and :func:`classmethod`) are " -"implemented as non-data descriptors. Accordingly, instances can redefine " -"and override methods. This allows individual instances to acquire behaviors " -"that differ from other instances of the same class." +"Python methods (including those decorated with :func:`@staticmethod " +"` and :func:`@classmethod `) are implemented as " +"non-data descriptors. Accordingly, instances can redefine and override " +"methods. This allows individual instances to acquire behaviors that differ " +"from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:1809 +#: ../../reference/datamodel.rst:1815 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:1816 +#: ../../reference/datamodel.rst:1822 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:1818 +#: ../../reference/datamodel.rst:1824 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " -"and deny the creation of *__dict__* and *__weakref__* (unless explicitly " -"declared in *__slots__* or available in a parent.)" +"and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " +"explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:1822 +#: ../../reference/datamodel.rst:1828 msgid "" -"The space saved over using *__dict__* can be significant. Attribute lookup " -"speed can be significantly improved as well." +"The space saved over using :attr:`~object.__dict__` can be significant. " +"Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:1827 +#: ../../reference/datamodel.rst:1833 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " -"for the declared variables and prevents the automatic creation of *__dict__* " -"and *__weakref__* for each instance." +"for the declared variables and prevents the automatic creation of :attr:" +"`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:1834 +#: ../../reference/datamodel.rst:1841 msgid "Notes on using *__slots__*" msgstr "" -#: ../../reference/datamodel.rst:1836 +#: ../../reference/datamodel.rst:1843 msgid "" -"When inheriting from a class without *__slots__*, the *__dict__* and " -"*__weakref__* attribute of the instances will always be accessible." +"When inheriting from a class without *__slots__*, the :attr:`~object." +"__dict__` and *__weakref__* attribute of the instances will always be " +"accessible." msgstr "" -#: ../../reference/datamodel.rst:1839 +#: ../../reference/datamodel.rst:1847 msgid "" -"Without a *__dict__* variable, instances cannot be assigned new variables " -"not listed in the *__slots__* definition. Attempts to assign to an unlisted " -"variable name raises :exc:`AttributeError`. If dynamic assignment of new " -"variables is desired, then add ``'__dict__'`` to the sequence of strings in " -"the *__slots__* declaration." +"Without a :attr:`~object.__dict__` variable, instances cannot be assigned " +"new variables not listed in the *__slots__* definition. Attempts to assign " +"to an unlisted variable name raises :exc:`AttributeError`. If dynamic " +"assignment of new variables is desired, then add ``'__dict__'`` to the " +"sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:1845 +#: ../../reference/datamodel.rst:1854 msgid "" "Without a *__weakref__* variable for each instance, classes defining " -"*__slots__* do not support weak references to its instances. If weak " -"reference support is needed, then add ``'__weakref__'`` to the sequence of " -"strings in the *__slots__* declaration." +"*__slots__* do not support :mod:`weak references ` to its " +"instances. If weak reference support is needed, then add ``'__weakref__'`` " +"to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:1850 +#: ../../reference/datamodel.rst:1860 msgid "" -"*__slots__* are implemented at the class level by creating descriptors (:ref:" -"`descriptors`) for each variable name. As a result, class attributes cannot " +"*__slots__* are implemented at the class level by creating :ref:`descriptors " +"` for each variable name. As a result, class attributes cannot " "be used to set default values for instance variables defined by *__slots__*; " "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:1856 +#: ../../reference/datamodel.rst:1866 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " -"However, child subclasses will get a *__dict__* and *__weakref__* unless " -"they also define *__slots__* (which should only contain names of any " -"*additional* slots)." +"However, child subclasses will get a :attr:`~object.__dict__` and " +"*__weakref__* unless they also define *__slots__* (which should only contain " +"names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:1862 +#: ../../reference/datamodel.rst:1872 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2247,60 +2252,62 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:1867 +#: ../../reference/datamodel.rst:1877 msgid "" "Nonempty *__slots__* does not work for classes derived from \"variable-length" "\" built-in types such as :class:`int`, :class:`bytes` and :class:`tuple`." msgstr "" -#: ../../reference/datamodel.rst:1870 +#: ../../reference/datamodel.rst:1880 msgid "" "Any non-string iterable may be assigned to *__slots__*. Mappings may also be " "used; however, in the future, special meaning may be assigned to the values " "corresponding to each key." msgstr "" -#: ../../reference/datamodel.rst:1874 +#: ../../reference/datamodel.rst:1884 msgid "" -"*__class__* assignment works only if both classes have the same *__slots__*." +":attr:`~instance.__class__` assignment works only if both classes have the " +"same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:1876 +#: ../../reference/datamodel.rst:1887 msgid "" -"Multiple inheritance with multiple slotted parent classes can be used, but " -"only one parent is allowed to have attributes created by slots (the other " -"bases must have empty slot layouts) - violations raise :exc:`TypeError`." +":ref:`Multiple inheritance ` with multiple slotted parent " +"classes can be used, but only one parent is allowed to have attributes " +"created by slots (the other bases must have empty slot layouts) - violations " +"raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:1881 +#: ../../reference/datamodel.rst:1893 msgid "" -"If an iterator is used for *__slots__* then a descriptor is created for each " -"of the iterator's values. However, the *__slots__* attribute will be an " -"empty iterator." +"If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " +"created for each of the iterator's values. However, the *__slots__* " +"attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:1888 +#: ../../reference/datamodel.rst:1901 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:1890 +#: ../../reference/datamodel.rst:1903 msgid "" -"Whenever a class inherits from another class, *__init_subclass__* is called " -"on that class. This way, it is possible to write classes which change the " -"behavior of subclasses. This is closely related to class decorators, but " -"where class decorators only affect the specific class they're applied to, " -"``__init_subclass__`` solely applies to future subclasses of the class " -"defining the method." +"Whenever a class inherits from another class, :meth:`~object." +"__init_subclass__` is called on that class. This way, it is possible to " +"write classes which change the behavior of subclasses. This is closely " +"related to class decorators, but where class decorators only affect the " +"specific class they're applied to, ``__init_subclass__`` solely applies to " +"future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:1899 +#: ../../reference/datamodel.rst:1912 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:1903 +#: ../../reference/datamodel.rst:1916 msgid "" "Keyword arguments which are given to a new class are passed to the parent's " "class ``__init_subclass__``. For compatibility with other classes using " @@ -2308,13 +2315,13 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:1917 +#: ../../reference/datamodel.rst:1930 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:1922 +#: ../../reference/datamodel.rst:1935 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2322,41 +2329,41 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:1930 +#: ../../reference/datamodel.rst:1943 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " -"makes callbacks to those with a :meth:`__set_name__` hook." +"makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:1935 +#: ../../reference/datamodel.rst:1948 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:1941 +#: ../../reference/datamodel.rst:1954 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:1952 +#: ../../reference/datamodel.rst:1965 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`\\ 。" -#: ../../reference/datamodel.rst:1960 +#: ../../reference/datamodel.rst:1973 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:1967 +#: ../../reference/datamodel.rst:1980 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:1971 +#: ../../reference/datamodel.rst:1984 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2364,41 +2371,41 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:1985 +#: ../../reference/datamodel.rst:1998 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:1988 +#: ../../reference/datamodel.rst:2001 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:1990 +#: ../../reference/datamodel.rst:2003 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:2004 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:2005 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:1993 +#: ../../reference/datamodel.rst:2006 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:1994 +#: ../../reference/datamodel.rst:2007 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:1998 +#: ../../reference/datamodel.rst:2011 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2000 +#: ../../reference/datamodel.rst:2013 msgid "" "If a base that appears in class definition is not an instance of :class:" "`type`, then an ``__mro_entries__`` method is searched on it. If found, it " @@ -2407,37 +2414,37 @@ msgid "" "such case the original base is ignored." msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2021 msgid ":pep:`560` - Core support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2012 +#: ../../reference/datamodel.rst:2025 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2016 +#: ../../reference/datamodel.rst:2029 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2018 +#: ../../reference/datamodel.rst:2031 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2019 +#: ../../reference/datamodel.rst:2032 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2034 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2037 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2446,41 +2453,41 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2034 +#: ../../reference/datamodel.rst:2047 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2039 +#: ../../reference/datamodel.rst:2052 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " "as ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (where the " "additional keyword arguments, if any, come from the class definition). The " -"``__prepare__`` method should be implemented as a :func:`classmethod`. The " -"namespace returned by ``__prepare__`` is passed in to ``__new__``, but when " -"the final class object is created the namespace is copied into a new " -"``dict``." +"``__prepare__`` method should be implemented as a :func:`classmethod " +"`. The namespace returned by ``__prepare__`` is passed in to " +"``__new__``, but when the final class object is created the namespace is " +"copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2047 +#: ../../reference/datamodel.rst:2061 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2052 +#: ../../reference/datamodel.rst:2066 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2053 +#: ../../reference/datamodel.rst:2067 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2057 +#: ../../reference/datamodel.rst:2071 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2062 +#: ../../reference/datamodel.rst:2076 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -2489,7 +2496,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2068 +#: ../../reference/datamodel.rst:2082 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -2498,11 +2505,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2077 +#: ../../reference/datamodel.rst:2091 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2084 +#: ../../reference/datamodel.rst:2098 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -2510,7 +2517,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2089 +#: ../../reference/datamodel.rst:2103 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -2521,7 +2528,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2099 +#: ../../reference/datamodel.rst:2113 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -2530,39 +2537,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2105 +#: ../../reference/datamodel.rst:2119 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2109 +#: ../../reference/datamodel.rst:2123 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2111 +#: ../../reference/datamodel.rst:2125 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2113 +#: ../../reference/datamodel.rst:2127 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2130 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2120 +#: ../../reference/datamodel.rst:2134 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -2570,19 +2577,19 @@ msgid "" "becomes the :attr:`~object.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2127 +#: ../../reference/datamodel.rst:2141 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2128 +#: ../../reference/datamodel.rst:2142 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2132 +#: ../../reference/datamodel.rst:2146 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2134 +#: ../../reference/datamodel.rst:2148 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -2590,17 +2597,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2141 +#: ../../reference/datamodel.rst:2155 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2143 +#: ../../reference/datamodel.rst:2157 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2146 +#: ../../reference/datamodel.rst:2160 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -2608,21 +2615,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2153 +#: ../../reference/datamodel.rst:2167 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2160 +#: ../../reference/datamodel.rst:2174 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2165 +#: ../../reference/datamodel.rst:2179 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -2630,11 +2637,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2176 +#: ../../reference/datamodel.rst:2190 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2173 +#: ../../reference/datamodel.rst:2187 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" @@ -2643,11 +2650,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2181 +#: ../../reference/datamodel.rst:2195 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2183 +#: ../../reference/datamodel.rst:2197 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -2655,65 +2662,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2191 +#: ../../reference/datamodel.rst:2205 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2191 +#: ../../reference/datamodel.rst:2205 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2194 +#: ../../reference/datamodel.rst:2208 msgid ":ref:`Generic Alias Types`" msgstr "" -#: ../../reference/datamodel.rst:2194 +#: ../../reference/datamodel.rst:2208 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2197 +#: ../../reference/datamodel.rst:2211 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2197 +#: ../../reference/datamodel.rst:2211 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2200 +#: ../../reference/datamodel.rst:2214 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2205 +#: ../../reference/datamodel.rst:2219 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2208 +#: ../../reference/datamodel.rst:2222 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2214 +#: ../../reference/datamodel.rst:2228 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2216 +#: ../../reference/datamodel.rst:2230 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2220 +#: ../../reference/datamodel.rst:2234 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -2722,7 +2729,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2226 +#: ../../reference/datamodel.rst:2240 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -2730,11 +2737,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2236 +#: ../../reference/datamodel.rst:2250 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2238 +#: ../../reference/datamodel.rst:2252 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -2744,14 +2751,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2245 +#: ../../reference/datamodel.rst:2259 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2273 +#: ../../reference/datamodel.rst:2287 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -2761,73 +2768,76 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2292 +#: ../../reference/datamodel.rst:2306 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:2317 +#: ../../reference/datamodel.rst:2331 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2316 +#: ../../reference/datamodel.rst:2330 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:2324 +#: ../../reference/datamodel.rst:2338 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2331 +#: ../../reference/datamodel.rst:2345 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2338 +#: ../../reference/datamodel.rst:2352 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2340 +#: ../../reference/datamodel.rst:2354 msgid "" "The following methods can be defined to implement container objects. " -"Containers usually are sequences (such as lists or tuples) or mappings (like " -"dictionaries), but can represent other containers as well. The first set of " -"methods is used either to emulate a sequence or to emulate a mapping; the " -"difference is that for a sequence, the allowable keys should be the integers " -"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or " -"slice objects, which define a range of items. It is also recommended that " -"mappings provide the methods :meth:`keys`, :meth:`values`, :meth:`items`, :" -"meth:`get`, :meth:`clear`, :meth:`setdefault`, :meth:`pop`, :meth:" -"`popitem`, :meth:`!copy`, and :meth:`update` behaving similar to those for " -"Python's standard dictionary objects. The :mod:`collections.abc` module " -"provides a :class:`~collections.abc.MutableMapping` abstract base class to " -"help create those methods from a base set of :meth:`__getitem__`, :meth:" -"`__setitem__`, :meth:`__delitem__`, and :meth:`keys`. Mutable sequences " -"should provide methods :meth:`append`, :meth:`count`, :meth:`index`, :meth:" -"`extend`, :meth:`insert`, :meth:`pop`, :meth:`remove`, :meth:`reverse` and :" -"meth:`sort`, like Python standard list objects. Finally, sequence types " -"should implement addition (meaning concatenation) and multiplication " -"(meaning repetition) by defining the methods :meth:`__add__`, :meth:" -"`__radd__`, :meth:`__iadd__`, :meth:`__mul__`, :meth:`__rmul__` and :meth:" -"`__imul__` described below; they should not define other numerical " -"operators. It is recommended that both mappings and sequences implement " -"the :meth:`__contains__` method to allow efficient use of the ``in`` " -"operator; for mappings, ``in`` should search the mapping's keys; for " -"sequences, it should search through the values. It is further recommended " -"that both mappings and sequences implement the :meth:`__iter__` method to " -"allow efficient iteration through the container; for mappings, :meth:" -"`__iter__` should iterate through the object's keys; for sequences, it " -"should iterate through the values." -msgstr "" - -#: ../../reference/datamodel.rst:2375 +"Containers usually are :term:`sequences ` (such as :class:`lists " +"` or :class:`tuples `) or :term:`mappings ` (like :" +"class:`dictionaries `), but can represent other containers as well. " +"The first set of methods is used either to emulate a sequence or to emulate " +"a mapping; the difference is that for a sequence, the allowable keys should " +"be the integers *k* for which ``0 <= k < N`` where *N* is the length of the " +"sequence, or :class:`slice` objects, which define a range of items. It is " +"also recommended that mappings provide the methods :meth:`keys`, :meth:" +"`values`, :meth:`items`, :meth:`get`, :meth:`clear`, :meth:`setdefault`, :" +"meth:`pop`, :meth:`popitem`, :meth:`!copy`, and :meth:`update` behaving " +"similar to those for Python's standard :class:`dictionary ` objects. " +"The :mod:`collections.abc` module provides a :class:`~collections.abc." +"MutableMapping` :term:`abstract base class` to help create those methods " +"from a base set of :meth:`~object.__getitem__`, :meth:`~object." +"__setitem__`, :meth:`~object.__delitem__`, and :meth:`keys`. Mutable " +"sequences should provide methods :meth:`append`, :meth:`count`, :meth:" +"`index`, :meth:`extend`, :meth:`insert`, :meth:`pop`, :meth:`remove`, :meth:" +"`reverse` and :meth:`sort`, like Python standard :class:`list` objects. " +"Finally, sequence types should implement addition (meaning concatenation) " +"and multiplication (meaning repetition) by defining the methods :meth:" +"`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`, :meth:" +"`~object.__mul__`, :meth:`~object.__rmul__` and :meth:`~object.__imul__` " +"described below; they should not define other numerical operators. It is " +"recommended that both mappings and sequences implement the :meth:`~object." +"__contains__` method to allow efficient use of the ``in`` operator; for " +"mappings, ``in`` should search the mapping's keys; for sequences, it should " +"search through the values. It is further recommended that both mappings and " +"sequences implement the :meth:`~object.__iter__` method to allow efficient " +"iteration through the container; for mappings, :meth:`__iter__` should " +"iterate through the object's keys; for sequences, it should iterate through " +"the values." +msgstr "" + +#: ../../reference/datamodel.rst:2394 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -2835,7 +2845,7 @@ msgid "" "zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2382 +#: ../../reference/datamodel.rst:2401 msgid "" "In CPython, the length is required to be at most :attr:`sys.maxsize`. If the " "length is larger than :attr:`!sys.maxsize` some features (such as :func:" @@ -2844,7 +2854,7 @@ msgid "" "`__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2391 +#: ../../reference/datamodel.rst:2410 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -2854,20 +2864,20 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2405 +#: ../../reference/datamodel.rst:2424 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2409 +#: ../../reference/datamodel.rst:2428 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2413 +#: ../../reference/datamodel.rst:2432 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2418 +#: ../../reference/datamodel.rst:2437 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers and slice objects. Note that the " @@ -2880,20 +2890,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2430 +#: ../../reference/datamodel.rst:2449 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2435 +#: ../../reference/datamodel.rst:2454 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:2443 +#: ../../reference/datamodel.rst:2462 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -2902,7 +2912,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2452 +#: ../../reference/datamodel.rst:2471 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -2911,13 +2921,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2461 +#: ../../reference/datamodel.rst:2480 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2467 +#: ../../reference/datamodel.rst:2486 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -2925,14 +2935,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:2475 +#: ../../reference/datamodel.rst:2494 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:2479 +#: ../../reference/datamodel.rst:2498 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -2941,7 +2951,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2486 +#: ../../reference/datamodel.rst:2505 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -2949,14 +2959,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2493 +#: ../../reference/datamodel.rst:2512 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:2497 +#: ../../reference/datamodel.rst:2516 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -2964,11 +2974,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:2506 +#: ../../reference/datamodel.rst:2525 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2508 +#: ../../reference/datamodel.rst:2527 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -2976,7 +2986,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2534 +#: ../../reference/datamodel.rst:2553 msgid "" "These methods are called to implement the binary arithmetic operations (``" "+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:`pow`, " @@ -2989,13 +2999,13 @@ msgid "" "version of the built-in :func:`pow` function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:2545 +#: ../../reference/datamodel.rst:2564 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return ``NotImplemented``." msgstr "" -#: ../../reference/datamodel.rst:2568 +#: ../../reference/datamodel.rst:2587 msgid "" "These methods are called to implement the binary arithmetic operations (``" "+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:`pow`, " @@ -3007,13 +3017,13 @@ msgid "" "__rsub__(x)`` is called if ``x.__sub__(y)`` returns *NotImplemented*." msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2598 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:2584 +#: ../../reference/datamodel.rst:2603 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3022,7 +3032,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:2605 +#: ../../reference/datamodel.rst:2624 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3038,19 +3048,19 @@ msgid "" "fact part of the data model." msgstr "" -#: ../../reference/datamodel.rst:2626 +#: ../../reference/datamodel.rst:2645 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:2639 +#: ../../reference/datamodel.rst:2658 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:2646 +#: ../../reference/datamodel.rst:2665 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3059,14 +3069,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2671 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:2664 +#: ../../reference/datamodel.rst:2683 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3075,17 +3085,17 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:2670 +#: ../../reference/datamodel.rst:2689 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:2677 +#: ../../reference/datamodel.rst:2696 msgid "With Statement Context Managers" msgstr "" -#: ../../reference/datamodel.rst:2679 +#: ../../reference/datamodel.rst:2698 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3095,32 +3105,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:2690 +#: ../../reference/datamodel.rst:2709 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:2693 +#: ../../reference/datamodel.rst:2712 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:2698 +#: ../../reference/datamodel.rst:2717 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:2705 +#: ../../reference/datamodel.rst:2724 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:2709 +#: ../../reference/datamodel.rst:2728 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3128,27 +3138,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:2713 +#: ../../reference/datamodel.rst:2732 msgid "" "Note that :meth:`__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2739 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2739 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:2727 +#: ../../reference/datamodel.rst:2746 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:2729 +#: ../../reference/datamodel.rst:2748 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3156,7 +3166,7 @@ msgid "" "patterns, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2755 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3165,7 +3175,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2761 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3175,19 +3185,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2752 +#: ../../reference/datamodel.rst:2771 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:2753 +#: ../../reference/datamodel.rst:2772 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:2759 +#: ../../reference/datamodel.rst:2778 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:2761 +#: ../../reference/datamodel.rst:2780 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3195,119 +3205,120 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:2776 +#: ../../reference/datamodel.rst:2795 msgid "" "The rationale behind this behaviour lies with a number of special methods " -"such as :meth:`__hash__` and :meth:`__repr__` that are implemented by all " -"objects, including type objects. If the implicit lookup of these methods " -"used the conventional lookup process, they would fail when invoked on the " -"type object itself::" +"such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " +"implemented by all objects, including type objects. If the implicit lookup " +"of these methods used the conventional lookup process, they would fail when " +"invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:2789 +#: ../../reference/datamodel.rst:2809 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:2798 +#: ../../reference/datamodel.rst:2818 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" -"meth:`__getattribute__` method even of the object's metaclass::" +"meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2844 msgid "" -"Bypassing the :meth:`__getattribute__` machinery in this fashion provides " -"significant scope for speed optimisations within the interpreter, at the " -"cost of some flexibility in the handling of special methods (the special " -"method *must* be set on the class object itself in order to be consistently " -"invoked by the interpreter)." +"Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " +"provides significant scope for speed optimisations within the interpreter, " +"at the cost of some flexibility in the handling of special methods (the " +"special method *must* be set on the class object itself in order to be " +"consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:2835 +#: ../../reference/datamodel.rst:2855 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:2839 +#: ../../reference/datamodel.rst:2859 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2861 msgid "" -"An :term:`awaitable` object generally implements an :meth:`__await__` " -"method. :term:`Coroutine objects ` returned from :keyword:`async " -"def` functions are awaitable." +"An :term:`awaitable` object generally implements an :meth:`~object." +"__await__` method. :term:`Coroutine objects ` returned from :" +"keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:2847 +#: ../../reference/datamodel.rst:2867 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` or :func:`asyncio.coroutine` are also " -"awaitable, but they do not implement :meth:`__await__`." +"awaitable, but they do not implement :meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:2853 +#: ../../reference/datamodel.rst:2873 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:2859 +#: ../../reference/datamodel.rst:2879 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:2865 +#: ../../reference/datamodel.rst:2885 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:2867 +#: ../../reference/datamodel.rst:2887 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " -"coroutine's execution can be controlled by calling :meth:`__await__` and " -"iterating over the result. When the coroutine has finished executing and " -"returns, the iterator raises :exc:`StopIteration`, and the exception's :attr:" -"`~StopIteration.value` attribute holds the return value. If the coroutine " -"raises an exception, it is propagated by the iterator. Coroutines should " -"not directly raise unhandled :exc:`StopIteration` exceptions." +"coroutine's execution can be controlled by calling :meth:`~object.__await__` " +"and iterating over the result. When the coroutine has finished executing " +"and returns, the iterator raises :exc:`StopIteration`, and the exception's :" +"attr:`~StopIteration.value` attribute holds the return value. If the " +"coroutine raises an exception, it is propagated by the iterator. Coroutines " +"should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:2875 +#: ../../reference/datamodel.rst:2895 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:2879 +#: ../../reference/datamodel.rst:2899 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:2885 +#: ../../reference/datamodel.rst:2905 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " -"is equivalent to advancing the iterator returned by :meth:`__await__`. If " -"*value* is not ``None``, this method delegates to the :meth:`~generator." -"send` method of the iterator that caused the coroutine to suspend. The " -"result (return value, :exc:`StopIteration`, or other exception) is the same " -"as when iterating over the :meth:`__await__` return value, described above." +"is equivalent to advancing the iterator returned by :meth:`~object." +"__await__`. If *value* is not ``None``, this method delegates to the :meth:" +"`~generator.send` method of the iterator that caused the coroutine to " +"suspend. The result (return value, :exc:`StopIteration`, or other " +"exception) is the same as when iterating over the :meth:`__await__` return " +"value, described above." msgstr "" -#: ../../reference/datamodel.rst:2895 +#: ../../reference/datamodel.rst:2915 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " "coroutine to suspend, if it has such a method. Otherwise, the exception is " "raised at the suspension point. The result (return value, :exc:" "`StopIteration`, or other exception) is the same as when iterating over the :" -"meth:`__await__` return value, described above. If the exception is not " -"caught in the coroutine, it propagates back to the caller." +"meth:`~object.__await__` return value, described above. If the exception is " +"not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:2906 +#: ../../reference/datamodel.rst:2926 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -3317,105 +3328,107 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:2914 +#: ../../reference/datamodel.rst:2934 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:2920 +#: ../../reference/datamodel.rst:2940 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:2922 +#: ../../reference/datamodel.rst:2942 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:2925 +#: ../../reference/datamodel.rst:2945 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:2929 +#: ../../reference/datamodel.rst:2949 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:2933 +#: ../../reference/datamodel.rst:2953 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:2936 +#: ../../reference/datamodel.rst:2956 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:2953 +#: ../../reference/datamodel.rst:2973 msgid "" -"Prior to Python 3.7, ``__aiter__`` could return an *awaitable* that would " -"resolve to an :term:`asynchronous iterator `." +"Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " +"that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:2958 +#: ../../reference/datamodel.rst:2978 msgid "" -"Starting with Python 3.7, ``__aiter__`` must return an asynchronous iterator " -"object. Returning anything else will result in a :exc:`TypeError` error." +"Starting with Python 3.7, :meth:`~object.__aiter__` must return an " +"asynchronous iterator object. Returning anything else will result in a :exc:" +"`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:2966 +#: ../../reference/datamodel.rst:2986 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:2968 +#: ../../reference/datamodel.rst:2988 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:2971 +#: ../../reference/datamodel.rst:2991 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:2975 +#: ../../reference/datamodel.rst:2995 msgid "" "Semantically similar to :meth:`__enter__`, the only difference being that it " "must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:2980 +#: ../../reference/datamodel.rst:3000 msgid "" "Semantically similar to :meth:`__exit__`, the only difference being that it " "must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:2983 +#: ../../reference/datamodel.rst:3003 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:2996 +#: ../../reference/datamodel.rst:3016 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:2997 +#: ../../reference/datamodel.rst:3017 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3001 +#: ../../reference/datamodel.rst:3021 msgid "" -"The :meth:`__hash__`, :meth:`__iter__`, :meth:`__reversed__`, and :meth:" -"`__contains__` methods have special handling for this; others will still " -"raise a :exc:`TypeError`, but may do so by relying on the behavior that " -"``None`` is not callable." +"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." +"__reversed__`, and :meth:`~object.__contains__` methods have special " +"handling for this; others will still raise a :exc:`TypeError`, but may do so " +"by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3006 +#: ../../reference/datamodel.rst:3027 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns ``NotImplemented``. Do not set the method to ``None`` if you " @@ -3423,9 +3436,9 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3012 +#: ../../reference/datamodel.rst:3033 msgid "" "For operands of the same type, it is assumed that if the non-reflected " -"method -- such as :meth:`__add__` -- fails then the overall operation is not " -"supported, which is why the reflected method is not called." +"method -- such as :meth:`~object.__add__` -- fails then the overall " +"operation is not supported, which is why the reflected method is not called." msgstr "" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 4e974328ca..ac4a95f9d2 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-09 00:12+0000\n" +"POT-Creation-Date: 2021-12-15 00:09+0000\n" "PO-Revision-Date: 2021-06-01 22:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -416,17 +416,17 @@ msgid "" "them from being interpreted as capture variable::" msgstr "" -#: ../../tutorial/controlflow.rst:410 +#: ../../tutorial/controlflow.rst:412 msgid "" "For a more detailed explanation and additional examples, you can look into :" "pep:`636` which is written in a tutorial format." msgstr "" -#: ../../tutorial/controlflow.rst:416 +#: ../../tutorial/controlflow.rst:418 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:418 +#: ../../tutorial/controlflow.rst:420 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" @@ -435,7 +435,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:438 +#: ../../tutorial/controlflow.rst:440 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -445,7 +445,7 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*\\ 。它之後必須連著該函式的名稱" "和置於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:443 +#: ../../tutorial/controlflow.rst:445 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -461,7 +461,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:450 +#: ../../tutorial/controlflow.rst:452 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -482,7 +482,7 @@ msgstr "" "域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" "`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:461 +#: ../../tutorial/controlflow.rst:463 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -497,7 +497,7 @@ msgstr "" "函式呼叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號" "表。" -#: ../../tutorial/controlflow.rst:468 +#: ../../tutorial/controlflow.rst:470 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -510,7 +510,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:479 +#: ../../tutorial/controlflow.rst:481 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " @@ -527,7 +527,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:490 +#: ../../tutorial/controlflow.rst:492 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" @@ -536,11 +536,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:506 +#: ../../tutorial/controlflow.rst:508 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:508 +#: ../../tutorial/controlflow.rst:510 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -550,7 +550,7 @@ msgstr "" "不外加一個運算式作為引數時會回傳 ``None``\\ 。一個函式執行到結束也會回傳 " "``None``\\ 。" -#: ../../tutorial/controlflow.rst:512 +#: ../../tutorial/controlflow.rst:514 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -572,22 +572,22 @@ msgstr "" "method 定義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同" "於 ``result = result + [a]``\\ ,但更有效率。" -#: ../../tutorial/controlflow.rst:527 +#: ../../tutorial/controlflow.rst:529 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:529 +#: ../../tutorial/controlflow.rst:531 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." msgstr "" "定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。" -#: ../../tutorial/controlflow.rst:536 +#: ../../tutorial/controlflow.rst:538 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:538 +#: ../../tutorial/controlflow.rst:540 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -598,22 +598,22 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:554 +#: ../../tutorial/controlflow.rst:556 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:556 +#: ../../tutorial/controlflow.rst:558 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "只給必要引數:\\ ``ask_ok('Do you really want to quit?')``" -#: ../../tutorial/controlflow.rst:558 +#: ../../tutorial/controlflow.rst:560 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" msgstr "給予一個選擇性引數:\\ ``ask_ok('OK to overwrite the file?', 2)``" -#: ../../tutorial/controlflow.rst:560 +#: ../../tutorial/controlflow.rst:562 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -621,14 +621,14 @@ msgstr "" "給予所有引數:\\ ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes " "or no!')``" -#: ../../tutorial/controlflow.rst:563 +#: ../../tutorial/controlflow.rst:565 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." msgstr "" "此例也使用了關鍵字 :keyword:`in`\\ ,用於測試序列中是否包含某個特定值。" -#: ../../tutorial/controlflow.rst:566 +#: ../../tutorial/controlflow.rst:568 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" @@ -637,11 +637,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:577 +#: ../../tutorial/controlflow.rst:579 msgid "will print ``5``." msgstr "將會輸出 ``5``\\ 。" -#: ../../tutorial/controlflow.rst:579 +#: ../../tutorial/controlflow.rst:581 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -654,24 +654,24 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:592 +#: ../../tutorial/controlflow.rst:594 msgid "This will print ::" msgstr "" "將會輸出:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:598 +#: ../../tutorial/controlflow.rst:600 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:" -#: ../../tutorial/controlflow.rst:611 +#: ../../tutorial/controlflow.rst:613 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:613 +#: ../../tutorial/controlflow.rst:615 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -682,7 +682,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:622 +#: ../../tutorial/controlflow.rst:624 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -693,14 +693,14 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:633 +#: ../../tutorial/controlflow.rst:635 msgid "but all the following calls would be invalid::" msgstr "" "但以下呼叫方式都無效:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:640 +#: ../../tutorial/controlflow.rst:642 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -718,7 +718,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:656 +#: ../../tutorial/controlflow.rst:658 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -736,31 +736,31 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:673 +#: ../../tutorial/controlflow.rst:675 msgid "It could be called like this::" msgstr "" "它可以被如此呼叫:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:681 +#: ../../tutorial/controlflow.rst:683 msgid "and of course it would print:" msgstr "" "輸出結果如下:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:694 +#: ../../tutorial/controlflow.rst:696 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。" -#: ../../tutorial/controlflow.rst:698 +#: ../../tutorial/controlflow.rst:700 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:700 +#: ../../tutorial/controlflow.rst:702 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -772,11 +772,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:706 +#: ../../tutorial/controlflow.rst:708 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:717 +#: ../../tutorial/controlflow.rst:719 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -787,22 +787,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:724 +#: ../../tutorial/controlflow.rst:726 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:726 +#: ../../tutorial/controlflow.rst:728 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." msgstr "" "若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。" -#: ../../tutorial/controlflow.rst:731 +#: ../../tutorial/controlflow.rst:733 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:733 +#: ../../tutorial/controlflow.rst:735 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -817,17 +817,17 @@ msgstr "" "``\\ (斜線)之前。\\ ``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函式" "定義中沒有 ``/``\\ ,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:741 +#: ../../tutorial/controlflow.rst:743 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:745 +#: ../../tutorial/controlflow.rst:747 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:747 +#: ../../tutorial/controlflow.rst:749 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -836,11 +836,11 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*\\ ,表明參數必須以關鍵字引數傳遞,必須在引數列" "表中第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``\\ 。" -#: ../../tutorial/controlflow.rst:753 +#: ../../tutorial/controlflow.rst:755 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:755 +#: ../../tutorial/controlflow.rst:757 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" @@ -849,7 +849,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:771 +#: ../../tutorial/controlflow.rst:773 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -860,7 +860,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:781 +#: ../../tutorial/controlflow.rst:783 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" @@ -869,7 +869,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:792 +#: ../../tutorial/controlflow.rst:794 msgid "" "The third function ``kwd_only_args`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" @@ -878,7 +878,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:803 +#: ../../tutorial/controlflow.rst:805 msgid "" "And the last uses all three calling conventions in the same function " "definition::" @@ -887,7 +887,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:823 +#: ../../tutorial/controlflow.rst:825 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -898,7 +898,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:828 +#: ../../tutorial/controlflow.rst:830 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -908,7 +908,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:837 +#: ../../tutorial/controlflow.rst:839 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -919,17 +919,17 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:844 +#: ../../tutorial/controlflow.rst:846 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:849 +#: ../../tutorial/controlflow.rst:851 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:851 +#: ../../tutorial/controlflow.rst:853 msgid "" "The use case will determine which parameters to use in the function " "definition::" @@ -938,11 +938,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:855 +#: ../../tutorial/controlflow.rst:857 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:857 +#: ../../tutorial/controlflow.rst:859 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -954,7 +954,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:862 +#: ../../tutorial/controlflow.rst:864 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -963,7 +963,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:865 +#: ../../tutorial/controlflow.rst:867 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -971,11 +971,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:871 +#: ../../tutorial/controlflow.rst:873 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:876 +#: ../../tutorial/controlflow.rst:878 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -988,7 +988,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:885 +#: ../../tutorial/controlflow.rst:887 msgid "" "Normally, these ``variadic`` arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1003,11 +1003,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:902 +#: ../../tutorial/controlflow.rst:904 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:904 +#: ../../tutorial/controlflow.rst:906 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1023,7 +1023,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:920 +#: ../../tutorial/controlflow.rst:922 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" @@ -1032,11 +1032,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:936 +#: ../../tutorial/controlflow.rst:938 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:938 +#: ../../tutorial/controlflow.rst:940 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1053,7 +1053,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:955 +#: ../../tutorial/controlflow.rst:957 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1063,17 +1063,17 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:967 +#: ../../tutorial/controlflow.rst:969 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:974 +#: ../../tutorial/controlflow.rst:976 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:977 +#: ../../tutorial/controlflow.rst:979 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1085,7 +1085,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:983 +#: ../../tutorial/controlflow.rst:985 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -1095,7 +1095,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:990 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -1117,18 +1117,18 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1000 +#: ../../tutorial/controlflow.rst:1002 msgid "Here is an example of a multi-line docstring::" msgstr "" "下面是多行說明字串的一個範例:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:1018 +#: ../../tutorial/controlflow.rst:1020 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1026 +#: ../../tutorial/controlflow.rst:1028 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -1137,7 +1137,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1030 +#: ../../tutorial/controlflow.rst:1032 msgid "" ":term:`Annotations ` are stored in the :attr:" "`__annotations__` attribute of the function as a dictionary and have no " @@ -1157,11 +1157,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:1052 +#: ../../tutorial/controlflow.rst:1054 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1057 +#: ../../tutorial/controlflow.rst:1059 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -1174,7 +1174,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1063 +#: ../../tutorial/controlflow.rst:1065 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -1184,11 +1184,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1068 +#: ../../tutorial/controlflow.rst:1070 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1070 +#: ../../tutorial/controlflow.rst:1072 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -1197,11 +1197,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1076 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1076 +#: ../../tutorial/controlflow.rst:1078 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -1209,21 +1209,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1079 +#: ../../tutorial/controlflow.rst:1081 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1082 +#: ../../tutorial/controlflow.rst:1084 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1084 +#: ../../tutorial/controlflow.rst:1086 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1086 +#: ../../tutorial/controlflow.rst:1088 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -1231,7 +1231,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:\\ ``a = f(1, 2) + g(3, " "4)``\\ 。" -#: ../../tutorial/controlflow.rst:1089 +#: ../../tutorial/controlflow.rst:1091 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -1243,7 +1243,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1094 +#: ../../tutorial/controlflow.rst:1096 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -1252,7 +1252,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1098 +#: ../../tutorial/controlflow.rst:1100 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -1261,11 +1261,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1104 +#: ../../tutorial/controlflow.rst:1106 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1105 +#: ../../tutorial/controlflow.rst:1107 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes "