7
7
msgstr ""
8
8
"Project-Id-Version :Python 3.12\n "
9
9
"Report-Msgid-Bugs-To :\n "
10
- "POT-Creation-Date :2022-12-22 00:15 +0000\n "
10
+ "POT-Creation-Date :2023-09-27 00:04 +0000\n "
11
11
"PO-Revision-Date :2018-05-23 16:15+0000\n "
12
12
"Last-Translator :Adrian Liaw <adrianliaw2000@gmail.com>\n "
13
13
"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -160,7 +160,7 @@ msgstr ""
160
160
msgid ""
161
161
"Exceptions raised by the callback will be noted on the standard error "
162
162
"output, but cannot be propagated; they are handled in exactly the same way "
163
- "as exceptions raised from an object's :meth:`__del__` method."
163
+ "as exceptions raised from an object's :meth:`~object. __del__` method."
164
164
msgstr ""
165
165
166
166
#: ../../library/weakref.rst:116
@@ -284,21 +284,20 @@ msgstr ""
284
284
#: ../../library/weakref.rst:223
285
285
msgid ""
286
286
":class:`WeakValueDictionary` objects have an additional method that has the "
287
- "same issues as the :meth:`keyrefs` method of :class:`WeakKeyDictionary` "
288
- "objects."
287
+ "same issues as the :meth:`WeakKeyDictionary.keyrefs` method."
289
288
msgstr ""
290
289
291
- #: ../../library/weakref.rst:230
290
+ #: ../../library/weakref.rst:229
292
291
msgid "Return an iterable of the weak references to the values."
293
292
msgstr ""
294
293
295
- #: ../../library/weakref.rst:235
294
+ #: ../../library/weakref.rst:234
296
295
msgid ""
297
296
"Set class that keeps weak references to its elements. An element will be "
298
297
"discarded when no strong reference to it exists any more."
299
298
msgstr ""
300
299
301
- #: ../../library/weakref.rst:241
300
+ #: ../../library/weakref.rst:240
302
301
msgid ""
303
302
"A custom :class:`ref` subclass which simulates a weak reference to a bound "
304
303
"method (i.e., a method defined on a class and looked up on an instance). "
@@ -307,149 +306,149 @@ msgid ""
307
306
"method until either the object or the original function dies::"
308
307
msgstr ""
309
308
310
- #: ../../library/weakref.rst:265
309
+ #: ../../library/weakref.rst:264
311
310
msgid ""
312
311
"*callback* is the same as the parameter of the same name to the :func:`ref` "
313
312
"function."
314
313
msgstr ""
315
314
316
- #: ../../library/weakref.rst:271
315
+ #: ../../library/weakref.rst:270
317
316
msgid ""
318
317
"Return a callable finalizer object which will be called when *obj* is "
319
318
"garbage collected. Unlike an ordinary weak reference, a finalizer will "
320
319
"always survive until the reference object is collected, greatly simplifying "
321
320
"lifecycle management."
322
321
msgstr ""
323
322
324
- #: ../../library/weakref.rst:276
323
+ #: ../../library/weakref.rst:275
325
324
msgid ""
326
325
"A finalizer is considered *alive* until it is called (either explicitly or "
327
326
"at garbage collection), and after that it is *dead*. Calling a live "
328
327
"finalizer returns the result of evaluating ``func(*arg, **kwargs)``, whereas "
329
328
"calling a dead finalizer returns :const:`None`."
330
329
msgstr ""
331
330
332
- #: ../../library/weakref.rst:281
331
+ #: ../../library/weakref.rst:280
333
332
msgid ""
334
333
"Exceptions raised by finalizer callbacks during garbage collection will be "
335
334
"shown on the standard error output, but cannot be propagated. They are "
336
- "handled in the same way as exceptions raised from an object's :meth:"
337
- "` __del__` method or a weak reference's callback."
335
+ "handled in the same way as exceptions raised from an object's :meth:`~object. "
336
+ "__del__` method or a weak reference's callback."
338
337
msgstr ""
339
338
340
- #: ../../library/weakref.rst:287
339
+ #: ../../library/weakref.rst:286
341
340
msgid ""
342
341
"When the program exits, each remaining live finalizer is called unless its :"
343
342
"attr:`atexit` attribute has been set to false. They are called in reverse "
344
343
"order of creation."
345
344
msgstr ""
346
345
347
- #: ../../library/weakref.rst:291
346
+ #: ../../library/weakref.rst:290
348
347
msgid ""
349
348
"A finalizer will never invoke its callback during the later part of the :"
350
349
"term:`interpreter shutdown` when module globals are liable to have been "
351
350
"replaced by :const:`None`."
352
351
msgstr ""
353
352
354
- #: ../../library/weakref.rst:297
353
+ #: ../../library/weakref.rst:296
355
354
msgid ""
356
355
"If *self* is alive then mark it as dead and return the result of calling "
357
356
"``func(*args, **kwargs)``. If *self* is dead then return :const:`None`."
358
357
msgstr ""
359
358
360
- #: ../../library/weakref.rst:303
359
+ #: ../../library/weakref.rst:302
361
360
msgid ""
362
361
"If *self* is alive then mark it as dead and return the tuple ``(obj, func, "
363
362
"args, kwargs)``. If *self* is dead then return :const:`None`."
364
363
msgstr ""
365
364
366
- #: ../../library/weakref.rst:309
365
+ #: ../../library/weakref.rst:308
367
366
msgid ""
368
367
"If *self* is alive then return the tuple ``(obj, func, args, kwargs)``. If "
369
368
"*self* is dead then return :const:`None`."
370
369
msgstr ""
371
370
372
- #: ../../library/weakref.rst:314
371
+ #: ../../library/weakref.rst:313
373
372
msgid "Property which is true if the finalizer is alive, false otherwise."
374
373
msgstr ""
375
374
376
- #: ../../library/weakref.rst:318
375
+ #: ../../library/weakref.rst:317
377
376
msgid ""
378
377
"A writable boolean property which by default is true. When the program "
379
378
"exits, it calls all remaining live finalizers for which :attr:`.atexit` is "
380
379
"true. They are called in reverse order of creation."
381
380
msgstr ""
382
381
383
- #: ../../library/weakref.rst:325
382
+ #: ../../library/weakref.rst:324
384
383
msgid ""
385
384
"It is important to ensure that *func*, *args* and *kwargs* do not own any "
386
385
"references to *obj*, either directly or indirectly, since otherwise *obj* "
387
386
"will never be garbage collected. In particular, *func* should not be a "
388
387
"bound method of *obj*."
389
388
msgstr ""
390
389
391
- #: ../../library/weakref.rst:335
390
+ #: ../../library/weakref.rst:334
392
391
msgid "The type object for weak references objects."
393
392
msgstr ""
394
393
395
- #: ../../library/weakref.rst:340
394
+ #: ../../library/weakref.rst:339
396
395
msgid "The type object for proxies of objects which are not callable."
397
396
msgstr ""
398
397
399
- #: ../../library/weakref.rst:345
398
+ #: ../../library/weakref.rst:344
400
399
msgid "The type object for proxies of callable objects."
401
400
msgstr ""
402
401
403
- #: ../../library/weakref.rst:350
402
+ #: ../../library/weakref.rst:349
404
403
msgid ""
405
404
"Sequence containing all the type objects for proxies. This can make it "
406
405
"simpler to test if an object is a proxy without being dependent on naming "
407
406
"both proxy types."
408
407
msgstr ""
409
408
410
- #: ../../library/weakref.rst:358
409
+ #: ../../library/weakref.rst:357
411
410
msgid ":pep:`205` - Weak References"
412
411
msgstr ""
413
412
414
- #: ../../library/weakref.rst:358
413
+ #: ../../library/weakref.rst:357
415
414
msgid ""
416
415
"The proposal and rationale for this feature, including links to earlier "
417
416
"implementations and information about similar features in other languages."
418
417
msgstr ""
419
418
420
- #: ../../library/weakref.rst:365
419
+ #: ../../library/weakref.rst:364
421
420
msgid "Weak Reference Objects"
422
421
msgstr ""
423
422
424
- #: ../../library/weakref.rst:367
423
+ #: ../../library/weakref.rst:366
425
424
msgid ""
426
425
"Weak reference objects have no methods and no attributes besides :attr:`ref."
427
426
"__callback__`. A weak reference object allows the referent to be obtained, "
428
427
"if it still exists, by calling it:"
429
428
msgstr ""
430
429
431
- #: ../../library/weakref.rst:381
430
+ #: ../../library/weakref.rst:380
432
431
msgid ""
433
432
"If the referent no longer exists, calling the reference object returns :"
434
433
"const:`None`:"
435
434
msgstr ""
436
435
437
- #: ../../library/weakref.rst:388
436
+ #: ../../library/weakref.rst:387
438
437
msgid ""
439
438
"Testing that a weak reference object is still live should be done using the "
440
439
"expression ``ref() is not None``. Normally, application code that needs to "
441
440
"use a reference object should follow this pattern::"
442
441
msgstr ""
443
442
444
- #: ../../library/weakref.rst:401
443
+ #: ../../library/weakref.rst:400
445
444
msgid ""
446
445
"Using a separate test for\" liveness\" creates race conditions in threaded "
447
446
"applications; another thread can cause a weak reference to become "
448
447
"invalidated before the weak reference is called; the idiom shown above is "
449
448
"safe in threaded applications as well as single-threaded applications."
450
449
msgstr ""
451
450
452
- #: ../../library/weakref.rst:406
451
+ #: ../../library/weakref.rst:405
453
452
msgid ""
454
453
"Specialized versions of :class:`ref` objects can be created through "
455
454
"subclassing. This is used in the implementation of the :class:"
@@ -459,122 +458,122 @@ msgid ""
459
458
"to retrieve the referent."
460
459
msgstr ""
461
460
462
- #: ../../library/weakref.rst:412
461
+ #: ../../library/weakref.rst:411
463
462
msgid ""
464
463
"This example shows how a subclass of :class:`ref` can be used to store "
465
464
"additional information about an object and affect the value that's returned "
466
465
"when the referent is accessed::"
467
466
msgstr ""
468
467
469
- #: ../../library/weakref.rst:439
468
+ #: ../../library/weakref.rst:438
470
469
msgid "Example"
471
470
msgstr "範例"
472
471
473
- #: ../../library/weakref.rst:441
472
+ #: ../../library/weakref.rst:440
474
473
msgid ""
475
474
"This simple example shows how an application can use object IDs to retrieve "
476
475
"objects that it has seen before. The IDs of the objects can then be used in "
477
476
"other data structures without forcing the objects to remain alive, but the "
478
477
"objects can still be retrieved by ID if they do."
479
478
msgstr ""
480
479
481
- #: ../../library/weakref.rst:466
480
+ #: ../../library/weakref.rst:465
482
481
msgid "Finalizer Objects"
483
482
msgstr ""
484
483
485
- #: ../../library/weakref.rst:468
484
+ #: ../../library/weakref.rst:467
486
485
msgid ""
487
486
"The main benefit of using :class:`finalize` is that it makes it simple to "
488
487
"register a callback without needing to preserve the returned finalizer "
489
488
"object. For instance"
490
489
msgstr ""
491
490
492
- #: ../../library/weakref.rst:482
491
+ #: ../../library/weakref.rst:481
493
492
msgid ""
494
493
"The finalizer can be called directly as well. However the finalizer will "
495
494
"invoke the callback at most once."
496
495
msgstr ""
497
496
498
- #: ../../library/weakref.rst:498
497
+ #: ../../library/weakref.rst:497
499
498
msgid ""
500
499
"You can unregister a finalizer using its :meth:`~finalize.detach` method. "
501
500
"This kills the finalizer and returns the arguments passed to the constructor "
502
501
"when it was created."
503
502
msgstr ""
504
503
505
- #: ../../library/weakref.rst:512
504
+ #: ../../library/weakref.rst:511
506
505
msgid ""
507
506
"Unless you set the :attr:`~finalize.atexit` attribute to :const:`False`, a "
508
507
"finalizer will be called when the program exits if it is still alive. For "
509
508
"instance"
510
509
msgstr ""
511
510
512
- #: ../../library/weakref.rst:527
513
- msgid "Comparing finalizers with :meth:`__del__` methods"
511
+ #: ../../library/weakref.rst:526
512
+ msgid "Comparing finalizers with :meth:`~object. __del__` methods"
514
513
msgstr ""
515
514
516
- #: ../../library/weakref.rst:529
515
+ #: ../../library/weakref.rst:528
517
516
msgid ""
518
517
"Suppose we want to create a class whose instances represent temporary "
519
518
"directories. The directories should be deleted with their contents when the "
520
519
"first of the following events occurs:"
521
520
msgstr ""
522
521
523
- #: ../../library/weakref.rst:533
522
+ #: ../../library/weakref.rst:532
524
523
msgid "the object is garbage collected,"
525
524
msgstr ""
526
525
527
- #: ../../library/weakref.rst:534
528
- msgid "the object's :meth:`remove` method is called, or"
526
+ #: ../../library/weakref.rst:533
527
+ msgid "the object's :meth:`! remove` method is called, or"
529
528
msgstr ""
530
529
531
- #: ../../library/weakref.rst:535
530
+ #: ../../library/weakref.rst:534
532
531
msgid "the program exits."
533
532
msgstr ""
534
533
535
- #: ../../library/weakref.rst:537
534
+ #: ../../library/weakref.rst:536
536
535
msgid ""
537
- "We might try to implement the class using a :meth:`__del__` method as "
538
- "follows::"
536
+ "We might try to implement the class using a :meth:`~object. __del__` method "
537
+ "as follows::"
539
538
msgstr ""
540
539
541
- #: ../../library/weakref.rst:556
540
+ #: ../../library/weakref.rst:555
542
541
msgid ""
543
- "Starting with Python 3.4, :meth:`__del__` methods no longer prevent "
542
+ "Starting with Python 3.4, :meth:`~object. __del__` methods no longer prevent "
544
543
"reference cycles from being garbage collected, and module globals are no "
545
544
"longer forced to :const:`None` during :term:`interpreter shutdown`. So this "
546
545
"code should work without any issues on CPython."
547
546
msgstr ""
548
547
549
- #: ../../library/weakref.rst:561
548
+ #: ../../library/weakref.rst:560
550
549
msgid ""
551
- "However, handling of :meth:`__del__` methods is notoriously implementation "
552
- "specific, since it depends on internal details of the interpreter's garbage "
553
- "collector implementation."
550
+ "However, handling of :meth:`~object. __del__` methods is notoriously "
551
+ "implementation specific, since it depends on internal details of the "
552
+ "interpreter's garbage collector implementation."
554
553
msgstr ""
555
554
556
- #: ../../library/weakref.rst:565
555
+ #: ../../library/weakref.rst:564
557
556
msgid ""
558
557
"A more robust alternative can be to define a finalizer which only references "
559
558
"the specific functions and objects that it needs, rather than having access "
560
559
"to the full state of the object::"
561
560
msgstr ""
562
561
563
- #: ../../library/weakref.rst:581
562
+ #: ../../library/weakref.rst:580
564
563
msgid ""
565
564
"Defined like this, our finalizer only receives a reference to the details it "
566
565
"needs to clean up the directory appropriately. If the object never gets "
567
566
"garbage collected the finalizer will still be called at exit."
568
567
msgstr ""
569
568
570
- #: ../../library/weakref.rst:585
569
+ #: ../../library/weakref.rst:584
571
570
msgid ""
572
571
"The other advantage of weakref based finalizers is that they can be used to "
573
572
"register finalizers for classes where the definition is controlled by a "
574
573
"third party, such as running code when a module is unloaded::"
575
574
msgstr ""
576
575
577
- #: ../../library/weakref.rst:597
576
+ #: ../../library/weakref.rst:596
578
577
msgid ""
579
578
"If you create a finalizer object in a daemonic thread just as the program "
580
579
"exits then there is the possibility that the finalizer does not get called "