7
7
msgstr ""
8
8
"Project-Id-Version : Python 3.10\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
- "POT-Creation-Date : 2021-10-26 16:47 +0000\n "
10
+ "POT-Creation-Date : 2021-11-06 00:08 +0000\n "
11
11
"PO-Revision-Date : 2018-05-23 16:02+0000\n "
12
12
"
Last-Translator :
Adrian Liaw <[email protected] >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -375,16 +375,16 @@ msgstr ""
375
375
#: ../../library/functools.rst:404
376
376
msgid ""
377
377
"To define a generic function, decorate it with the ``@singledispatch`` "
378
- "decorator. Note that the dispatch happens on the type of the first argument, "
379
- "create your function accordingly ::"
378
+ "decorator. When defining a function using ``@singledispatch``, note that the "
379
+ "dispatch happens on the type of the first argument ::"
380
380
msgstr ""
381
381
382
382
#: ../../library/functools.rst:415
383
383
msgid ""
384
384
"To add overloaded implementations to the function, use the :func:`register` "
385
- "attribute of the generic function. It is a decorator. For functions "
386
- "annotated with types, the decorator will infer the type of the first "
387
- "argument automatically::"
385
+ "attribute of the generic function, which can be used as a decorator. For "
386
+ "functions annotated with types, the decorator will infer the type of the "
387
+ "first argument automatically::"
388
388
msgstr ""
389
389
390
390
#: ../../library/functools.rst:433
@@ -395,15 +395,15 @@ msgstr ""
395
395
396
396
#: ../../library/functools.rst:444
397
397
msgid ""
398
- "To enable registering lambdas and pre-existing functions, the :func: "
399
- "`register` attribute can be used in a functional form::"
398
+ "To enable registering :term:` lambdas<lambda>` and pre-existing functions, "
399
+ "the :func: `register` attribute can also be used in a functional form::"
400
400
msgstr ""
401
401
402
402
#: ../../library/functools.rst:452
403
403
msgid ""
404
- "The :func:`register` attribute returns the undecorated function which "
405
- "enables decorator stacking, pickling, as well as creating unit tests for "
406
- "each variant independently::"
404
+ "The :func:`register` attribute returns the undecorated function. This "
405
+ "enables decorator stacking, :mod:` pickling<pickle>`, and the creation of "
406
+ "unit tests for each variant independently::"
407
407
msgstr ""
408
408
409
409
#: ../../library/functools.rst:466
@@ -416,60 +416,65 @@ msgstr ""
416
416
msgid ""
417
417
"Where there is no registered implementation for a specific type, its method "
418
418
"resolution order is used to find a more generic implementation. The original "
419
- "function decorated with ``@singledispatch`` is registered for the base "
420
- "``object`` type, which means it is used if no better implementation is found."
419
+ "function decorated with ``@singledispatch`` is registered for the base :"
420
+ "class:`object` type, which means it is used if no better implementation is "
421
+ "found."
421
422
msgstr ""
422
423
423
424
#: ../../library/functools.rst:492
424
425
msgid ""
425
- "If an implementation registered to :term:`abstract base class`, virtual "
426
- "subclasses will be dispatched to that implementation::"
426
+ "If an implementation is registered to an :term:`abstract base class`, "
427
+ "virtual subclasses of the base class will be dispatched to that "
428
+ "implementation::"
427
429
msgstr ""
428
430
429
- #: ../../library/functools.rst:506
431
+ #: ../../library/functools.rst:507
430
432
msgid ""
431
- "To check which implementation will the generic function choose for a given "
433
+ "To check which implementation the generic function will choose for a given "
432
434
"type, use the ``dispatch()`` attribute::"
433
435
msgstr ""
434
436
435
- #: ../../library/functools.rst:514
437
+ #: ../../library/functools.rst:515
436
438
msgid ""
437
439
"To access all registered implementations, use the read-only ``registry`` "
438
440
"attribute::"
439
441
msgstr ""
440
442
441
- #: ../../library/functools.rst:528
442
- msgid "The :func:`register` attribute supports using type annotations."
443
+ #: ../../library/functools.rst:529
444
+ msgid "The :func:`register` attribute now supports using type annotations."
443
445
msgstr ""
444
446
445
- #: ../../library/functools.rst:534
447
+ #: ../../library/functools.rst:535
446
448
msgid ""
447
449
"Transform a method into a :term:`single-dispatch <single dispatch>` :term:"
448
450
"`generic function`."
449
451
msgstr ""
450
452
451
- #: ../../library/functools.rst:537
453
+ #: ../../library/functools.rst:538
452
454
msgid ""
453
455
"To define a generic method, decorate it with the ``@singledispatchmethod`` "
454
- "decorator. Note that the dispatch happens on the type of the first non-self "
455
- "or non-cls argument, create your function accordingly::"
456
+ "decorator. When defining a function using ``@singledispatchmethod``, note "
457
+ "that the dispatch happens on the type of the first non-*self* or non-*cls* "
458
+ "argument::"
456
459
msgstr ""
457
460
458
- #: ../../library/functools.rst:554
461
+ #: ../../library/functools.rst:556
459
462
msgid ""
460
- "``@singledispatchmethod`` supports nesting with other decorators such as "
461
- "``@classmethod``. Note that to allow for ``dispatcher.register``, "
462
- "``singledispatchmethod`` must be the *outer most* decorator. Here is the "
463
- "``Negator`` class with the ``neg`` methods being class bound::"
463
+ "``@singledispatchmethod`` supports nesting with other decorators such as :"
464
+ "func:`@classmethod<classmethod>`. Note that to allow for ``dispatcher."
465
+ "register``, ``singledispatchmethod`` must be the *outer most* decorator. "
466
+ "Here is the ``Negator`` class with the ``neg`` methods bound to the class, "
467
+ "rather than an instance of the class::"
464
468
msgstr ""
465
469
466
- #: ../../library/functools.rst:575
470
+ #: ../../library/functools.rst:578
467
471
msgid ""
468
- "The same pattern can be used for other similar decorators: ``staticmethod``, "
469
- "``abstractmethod``, and others."
472
+ "The same pattern can be used for other similar decorators: :func:"
473
+ "`@staticmethod<staticmethod>`, :func:`@abstractmethod<abc.abstractmethod>`, "
474
+ "and others."
470
475
msgstr ""
471
476
472
- #: ../../library/functools.rst:583
477
+ #: ../../library/functools.rst:587
473
478
msgid ""
474
479
"Update a *wrapper* function to look like the *wrapped* function. The "
475
480
"optional arguments are tuples to specify which attributes of the original "
@@ -483,15 +488,15 @@ msgid ""
483
488
"``__dict__``, i.e. the instance dictionary)."
484
489
msgstr ""
485
490
486
- #: ../../library/functools.rst:593
491
+ #: ../../library/functools.rst:597
487
492
msgid ""
488
493
"To allow access to the original function for introspection and other "
489
494
"purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), "
490
495
"this function automatically adds a ``__wrapped__`` attribute to the wrapper "
491
496
"that refers to the function being wrapped."
492
497
msgstr ""
493
498
494
- #: ../../library/functools.rst:598
499
+ #: ../../library/functools.rst:602
495
500
msgid ""
496
501
"The main intended use for this function is in :term:`decorator` functions "
497
502
"which wrap the decorated function and return the wrapper. If the wrapper "
@@ -500,7 +505,7 @@ msgid ""
500
505
"is typically less than helpful."
501
506
msgstr ""
502
507
503
- #: ../../library/functools.rst:604
508
+ #: ../../library/functools.rst:608
504
509
msgid ""
505
510
":func:`update_wrapper` may be used with callables other than functions. Any "
506
511
"attributes named in *assigned* or *updated* that are missing from the object "
@@ -509,69 +514,69 @@ msgid ""
509
514
"wrapper function itself is missing any attributes named in *updated*."
510
515
msgstr ""
511
516
512
- #: ../../library/functools.rst:610
517
+ #: ../../library/functools.rst:614
513
518
msgid "Automatic addition of the ``__wrapped__`` attribute."
514
519
msgstr ""
515
520
516
- #: ../../library/functools.rst:613
521
+ #: ../../library/functools.rst:617
517
522
msgid "Copying of the ``__annotations__`` attribute by default."
518
523
msgstr ""
519
524
520
- #: ../../library/functools.rst:616
525
+ #: ../../library/functools.rst:620
521
526
msgid "Missing attributes no longer trigger an :exc:`AttributeError`."
522
527
msgstr ""
523
528
524
- #: ../../library/functools.rst:619
529
+ #: ../../library/functools.rst:623
525
530
msgid ""
526
531
"The ``__wrapped__`` attribute now always refers to the wrapped function, "
527
532
"even if that function defined a ``__wrapped__`` attribute. (see :issue:"
528
533
"`17482`)"
529
534
msgstr ""
530
535
531
- #: ../../library/functools.rst:627
536
+ #: ../../library/functools.rst:631
532
537
msgid ""
533
538
"This is a convenience function for invoking :func:`update_wrapper` as a "
534
539
"function decorator when defining a wrapper function. It is equivalent to "
535
540
"``partial(update_wrapper, wrapped=wrapped, assigned=assigned, "
536
541
"updated=updated)``. For example::"
537
542
msgstr ""
538
543
539
- #: ../../library/functools.rst:653
544
+ #: ../../library/functools.rst:657
540
545
msgid ""
541
546
"Without the use of this decorator factory, the name of the example function "
542
547
"would have been ``'wrapper'``, and the docstring of the original :func:"
543
548
"`example` would have been lost."
544
549
msgstr ""
545
550
546
- #: ../../library/functools.rst:661
551
+ #: ../../library/functools.rst:665
547
552
msgid ":class:`partial` Objects"
548
553
msgstr ""
549
554
550
- #: ../../library/functools.rst:663
555
+ #: ../../library/functools.rst:667
551
556
msgid ""
552
557
":class:`partial` objects are callable objects created by :func:`partial`. "
553
558
"They have three read-only attributes:"
554
559
msgstr ""
555
560
556
- #: ../../library/functools.rst:669
561
+ #: ../../library/functools.rst:673
557
562
msgid ""
558
563
"A callable object or function. Calls to the :class:`partial` object will be "
559
564
"forwarded to :attr:`func` with new arguments and keywords."
560
565
msgstr ""
561
566
562
- #: ../../library/functools.rst:675
567
+ #: ../../library/functools.rst:679
563
568
msgid ""
564
569
"The leftmost positional arguments that will be prepended to the positional "
565
570
"arguments provided to a :class:`partial` object call."
566
571
msgstr ""
567
572
568
- #: ../../library/functools.rst:681
573
+ #: ../../library/functools.rst:685
569
574
msgid ""
570
575
"The keyword arguments that will be supplied when the :class:`partial` object "
571
576
"is called."
572
577
msgstr ""
573
578
574
- #: ../../library/functools.rst:684
579
+ #: ../../library/functools.rst:688
575
580
msgid ""
576
581
":class:`partial` objects are like :class:`function` objects in that they are "
577
582
"callable, weak referencable, and can have attributes. There are some "
0 commit comments