-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy path2.4.po
2894 lines (2575 loc) · 126 KB
/
2.4.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2025, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Arihiro TAKASE, 2023
# tomo, 2023
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-14 14:17+0000\n"
"PO-Revision-Date: 2021-06-28 01:51+0000\n"
"Last-Translator: tomo, 2023\n"
"Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/"
"ja/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ja\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../whatsnew/2.4.rst:3
msgid "What's New in Python 2.4"
msgstr "What's New in Python 2.4"
#: ../../whatsnew/2.4.rst:0
msgid "Author"
msgstr "著者"
#: ../../whatsnew/2.4.rst:5
msgid "A.M. Kuchling"
msgstr "A.M. Kuchling"
#: ../../whatsnew/2.4.rst:14
msgid ""
"This article explains the new features in Python 2.4.1, released on March "
"30, 2005."
msgstr ""
"この文書は 2005 年 3 月 30 日にリリースされた Python 2.4.1 の新機能について解"
"説します。 "
#: ../../whatsnew/2.4.rst:17
msgid ""
"Python 2.4 is a medium-sized release. It doesn't introduce as many changes "
"as the radical Python 2.2, but introduces more features than the "
"conservative 2.3 release. The most significant new language features are "
"function decorators and generator expressions; most other changes are to the "
"standard library."
msgstr ""
"Python 2.4 は、真ん中サイズ、のリリースです。急進的だった Python 2.2 ほどには"
"多くの変更をしていませんが、保守的だった 2.3 よりは多くの機能を導入していま"
"す。新しい言語機能で最も重要なのが、関数デコレータとジェネレータ式です。ほか"
"のほとんどの変更は標準ライブラリに対するものです。"
#: ../../whatsnew/2.4.rst:22
msgid ""
"According to the CVS change logs, there were 481 patches applied and 502 "
"bugs fixed between Python 2.3 and 2.4. Both figures are likely to be "
"underestimates."
msgstr ""
"Python 2.3 から 2.4 の CVS 変更ログによれば、適用されたパッチは 481、フィック"
"スされたバグは 502 ありました。ともに、少なく見積もって、です。"
#: ../../whatsnew/2.4.rst:25
msgid ""
"This article doesn't attempt to provide a complete specification of every "
"single new feature, but instead provides a brief introduction to each "
"feature. For full details, you should refer to the documentation for Python "
"2.4, such as the Python Library Reference and the Python Reference Manual. "
"Often you will be referred to the PEP for a particular new feature for "
"explanations of the implementation and design rationale."
msgstr ""
"このドキュメントは個々の新機能の完全な詳細を提供するのではなくて、簡易な概要"
"を提供することを目的にしています。完全な詳細が知りたければ、 Python ライブラ"
"リリファレンス、Python リファレンスマニュアルのような Python 2.4 のドキュメン"
"トを参照してください。多くの場合個別の新機能についての実装の説明やデザインの"
"根拠については PEP に託されています。"
#: ../../whatsnew/2.4.rst:36
msgid "PEP 218: Built-In Set Objects"
msgstr "PEP 218: ビルトインの集合オブジェクト"
#: ../../whatsnew/2.4.rst:38
msgid ""
"Python 2.3 introduced the :mod:`sets` module. C implementations of set data "
"types have now been added to the Python core as two new built-in types, "
"``set(iterable)`` and ``frozenset(iterable)``. They provide high speed "
"operations for membership testing, for eliminating duplicates from "
"sequences, and for mathematical operations like unions, intersections, "
"differences, and symmetric differences. ::"
msgstr ""
"Python 2.3 では :mod:`sets` モジュールを導入しました。集合データ型の C 実装"
"が Python コアに新たに、2 つの新しいビルトイン型 ``set(iterable)`` と "
"``frozenset(iterable)`` として追加されています。これらは要素が集合に属してい"
"るかのメンバシップテスト、シーケンスからの重複の削除、それに和集合 (union)、"
"共通集合 (intersection)、 差 (difference)、対称差 (symmetric difference) と"
"いった数学演算を高速に行います::"
#: ../../whatsnew/2.4.rst:45
msgid ""
">>> a = set('abracadabra') # form a set from a string\n"
">>> 'z' in a # fast membership testing\n"
"False\n"
">>> a # unique letters in a\n"
"set(['a', 'r', 'b', 'c', 'd'])\n"
">>> ''.join(a) # convert back into a string\n"
"'arbcd'\n"
"\n"
">>> b = set('alacazam') # form a second set\n"
">>> a - b # letters in a but not in b\n"
"set(['r', 'd', 'b'])\n"
">>> a | b # letters in either a or b\n"
"set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'])\n"
">>> a & b # letters in both a and b\n"
"set(['a', 'c'])\n"
">>> a ^ b # letters in a or b but not both\n"
"set(['r', 'd', 'b', 'm', 'z', 'l'])\n"
"\n"
">>> a.add('z') # add a new element\n"
">>> a.update('wxy') # add multiple new elements\n"
">>> a\n"
"set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])\n"
">>> a.remove('x') # take one element out\n"
">>> a\n"
"set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])"
msgstr ""
#: ../../whatsnew/2.4.rst:71
msgid ""
"The :func:`frozenset` type is an immutable version of :func:`set`. Since it "
"is immutable and hashable, it may be used as a dictionary key or as a member "
"of another set."
msgstr ""
":func:`frozenset` 型は :func:`set` の :term:`immutable` 版です。 immutable か"
"つハッシュ可能なので、辞書のキーやほかの set のメンバとして使えるでしょう。"
#: ../../whatsnew/2.4.rst:75
msgid ""
"The :mod:`sets` module remains in the standard library, and may be useful if "
"you wish to subclass the :class:`Set` or :class:`ImmutableSet` classes. "
"There are currently no plans to deprecate the module."
msgstr ""
"2.3 で追加された :mod:`sets` モジュールは標準ライブラリに残されていて、 :"
"class:`Set` や :class:`ImmutableSet` をサブクラス化したければ便利かもしれませ"
"ん。今のところこれを撤廃する予定はありません。(---訳注: :mod:`sets` モジュー"
"ルは 2.6 で非推奨となっています。---)"
#: ../../whatsnew/2.4.rst:82
msgid ":pep:`218` - Adding a Built-In Set Object Type"
msgstr ":pep:`218` - 集合オブジェクト型をビルトインに追加する"
#: ../../whatsnew/2.4.rst:83
msgid ""
"Originally proposed by Greg Wilson and ultimately implemented by Raymond "
"Hettinger."
msgstr ""
"元々は Greg Wilson によって提案され、完全な実装は Raymond Hettinger によって"
"なされました。"
#: ../../whatsnew/2.4.rst:90
msgid "PEP 237: Unifying Long Integers and Integers"
msgstr "PEP 237: 長整数と整数を一体化していく"
#: ../../whatsnew/2.4.rst:92
msgid ""
"The lengthy transition process for this PEP, begun in Python 2.2, takes "
"another step forward in Python 2.4. In 2.3, certain integer operations that "
"would behave differently after int/long unification triggered :exc:"
"`FutureWarning` warnings and returned values limited to 32 or 64 bits "
"(depending on your platform). In 2.4, these expressions no longer produce a "
"warning and instead produce a different result that's usually a long integer."
msgstr ""
"この PEP の非常に長期に渡る移行は Python 2.2 に始まり、Python 2.4 でさらにも"
"う一歩前進しています。2.3 では int/long の一体化後に異なる振る舞いをする整数"
"演算をすると :exc:`FutureWarning` 警告を出して、結果の値は (プラットフォーム"
"依存で) 32 ビットまたは 64 ビットに制限していました。2.4 ではこれらの式はもう"
"警告は出さず、代わりにいつでも(2.3 とは違った)長整数となる結果をはじき出しま"
"す。"
#: ../../whatsnew/2.4.rst:99
msgid ""
"The problematic expressions are primarily left shifts and lengthy "
"hexadecimal and octal constants. For example, ``2 << 32`` results in a "
"warning in 2.3, evaluating to 0 on 32-bit platforms. In Python 2.4, this "
"expression now returns the correct answer, 8589934592."
msgstr ""
"問題を起こしうる式は主として左シフトで、そして長い 16 進リテラルと 8 進リテラ"
"ルです。例えば ``2 << 32`` は 2.3 では警告とともに 32 ビットプラットフォーム"
"では結果は 0 になります。Python 2.4 ではこの式は正しい答えの 8589934592 にな"
"ります。"
#: ../../whatsnew/2.4.rst:107
msgid ":pep:`237` - Unifying Long Integers and Integers"
msgstr ":pep:`237` - 長整数と整数を一体化していく"
#: ../../whatsnew/2.4.rst:108
msgid ""
"Original PEP written by Moshe Zadka and GvR. The changes for 2.4 were "
"implemented by Kalle Svensson."
msgstr ""
"オリジナルの PEP は Moshe Zadka と GvR (Guido van Rossum) によって書かれまし"
"た。.2.4 での変更については Kalle Svensson によって実装されました。"
#: ../../whatsnew/2.4.rst:115
msgid "PEP 289: Generator Expressions"
msgstr "PEP 289: ジェネレータ式"
#: ../../whatsnew/2.4.rst:117
msgid ""
"The iterator feature introduced in Python 2.2 and the :mod:`itertools` "
"module make it easier to write programs that loop through large data sets "
"without having the entire data set in memory at one time. List "
"comprehensions don't fit into this picture very well because they produce a "
"Python list object containing all of the items. This unavoidably pulls all "
"of the objects into memory, which can be a problem if your data set is very "
"large. When trying to write a functionally styled program, it would be "
"natural to write something like::"
msgstr ""
#: ../../whatsnew/2.4.rst:125
msgid ""
"links = [link for link in get_all_links() if not link.followed]\n"
"for link in links:\n"
" ..."
msgstr ""
#: ../../whatsnew/2.4.rst:129
msgid "instead of ::"
msgstr "こうではなく ::"
#: ../../whatsnew/2.4.rst:131
msgid ""
"for link in get_all_links():\n"
" if link.followed:\n"
" continue\n"
" ..."
msgstr ""
#: ../../whatsnew/2.4.rst:136
msgid ""
"The first form is more concise and perhaps more readable, but if you're "
"dealing with a large number of link objects you'd have to write the second "
"form to avoid having all link objects in memory at the same time."
msgstr ""
"最初の形の方が簡潔でおそらく読みやすいですが、扱っているのがとても多くのリン"
"クオブジェクトであるならば、全てのリンクオブジェクトが一気にメモリに載らない"
"ように二つ目の形で書く必要がありました。"
#: ../../whatsnew/2.4.rst:140
msgid ""
"Generator expressions work similarly to list comprehensions but don't "
"materialize the entire list; instead they create a generator that will "
"return elements one by one. The above example could be written as::"
msgstr ""
"ジェネレータ式はリスト内包と似た動作をしますが、リスト全体を実体化しません; "
"代わりにそれは、要素を一つずつ返すジェネレータを返します。上述の例はこう書け"
"ます::"
#: ../../whatsnew/2.4.rst:144
msgid ""
"links = (link for link in get_all_links() if not link.followed)\n"
"for link in links:\n"
" ..."
msgstr ""
#: ../../whatsnew/2.4.rst:148
msgid ""
"Generator expressions always have to be written inside parentheses, as in "
"the above example. The parentheses signalling a function call also count, "
"so if you want to create an iterator that will be immediately passed to a "
"function you could write::"
msgstr ""
"上の例でのように、ジェネレータ式は常に括弧の中に書かなければなりません。関数"
"呼び出しを囲む括弧もそれに含まれるので、関数にそのまま渡すイテレータを作りた"
"ければこれで良いです::"
#: ../../whatsnew/2.4.rst:153
msgid "print sum(obj.count for obj in list_all_objects())"
msgstr ""
#: ../../whatsnew/2.4.rst:155
msgid ""
"Generator expressions differ from list comprehensions in various small ways. "
"Most notably, the loop variable (*obj* in the above example) is not "
"accessible outside of the generator expression. List comprehensions leave "
"the variable assigned to its last value; future versions of Python will "
"change this, making list comprehensions match generator expressions in this "
"respect."
msgstr ""
"ジェネレータ式はリスト内包とは色々小さい点で違います。最も顕著なのはループ変"
"数 (上の例での *obj*) がジェネレータ式の外からアクセス不能なことです。リスト"
"内包はループの制御変数が最後に代入された値で残ります; 将来のバージョンの "
"Python では、この振る舞いはリスト内包がこの点でジェネレータ式と同じになるよう"
"に変更されます。 (---訳注: Python 2.7 でもリスト内包のこの振る舞いは変わって"
"おらず、警告ともなりません。制御変数が内包のスコープ外で可視でなくなったのは "
"Python 3.0 からです。---)"
#: ../../whatsnew/2.4.rst:164
msgid ":pep:`289` - Generator Expressions"
msgstr ":pep:`289` - ジェネレータ式"
#: ../../whatsnew/2.4.rst:165
msgid ""
"Proposed by Raymond Hettinger and implemented by Jiwon Seo with early "
"efforts steered by Hye-Shik Chang."
msgstr ""
"Raymond Hettinger によって提案され、Hye-Shik Chang に導かれた早期の尽力によっ"
"て Jiwon Seo により実装されました。"
#: ../../whatsnew/2.4.rst:172
msgid "PEP 292: Simpler String Substitutions"
msgstr "PEP 292: より単純な文字列置換 (string substitution)"
#: ../../whatsnew/2.4.rst:174
msgid ""
"Some new classes in the standard library provide an alternative mechanism "
"for substituting variables into strings; this style of substitution may be "
"better for applications where untrained users need to edit templates."
msgstr ""
"標準ライブラリに、文字列を変数で置換するための代替メカニズムをもたらす新しい"
"くつかのクラスが追加されました; この置換のスタイルは、訓練されていないユーザ"
"がテンプレートを編集する必要があるようなアプリケーションにとって、より良いも"
"のでしょう。"
#: ../../whatsnew/2.4.rst:178
msgid "The usual way of substituting variables by name is the ``%`` operator::"
msgstr "変数置換を名前で行うためのいつもの方法は ``%`` 演算子です::"
#: ../../whatsnew/2.4.rst:180
msgid ""
">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n"
"'2: The Best of Times'"
msgstr ""
#: ../../whatsnew/2.4.rst:183
msgid ""
"When writing the template string, it can be easy to forget the ``i`` or "
"``s`` after the closing parenthesis. This isn't a big problem if the "
"template is in a Python module, because you run the code, get an "
"\"Unsupported format character\" :exc:`ValueError`, and fix the problem. "
"However, consider an application such as Mailman where template strings or "
"translations are being edited by users who aren't aware of the Python "
"language. The format string's syntax is complicated to explain to such "
"users, and if they make a mistake, it's difficult to provide helpful "
"feedback to them."
msgstr ""
"テンプレート文字列を書くのに、閉じ括弧のあとの ``i`` や ``s`` を忘れやすいで"
"す。これはそのテンプレートが Python モジュール内にあるなら大問題でもありませ"
"ん。コードを実行し、「サポートされないフォーマット文字 (unsupported format "
"character)」な :exc:`ValueError` を喰らい、問題を直すだけのことです。ですが、"
"例えば Mailman のようなアプリケーションを考えてみてください。テンプレート文字"
"列や翻訳は、Python 言語について承知していないユーザが編集するのです。フォー"
"マット文字列の構文はそのようなユーザに説明するには複雑で、彼らが間違いをやら"
"かした場合には、親切なフィードバックを彼らに与えるのは難しいのです。"
#: ../../whatsnew/2.4.rst:192
msgid ""
"PEP 292 adds a :class:`Template` class to the :mod:`string` module that uses "
"``$`` to indicate a substitution::"
msgstr ""
"PEP 292 は :mod:`string` モジュールに :class:`Template` クラスを追加します。"
"これは置換を指示するのに ``$`` を使います::"
#: ../../whatsnew/2.4.rst:195
msgid ""
">>> import string\n"
">>> t = string.Template('$page: $title')\n"
">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n"
"'2: The Best of Times'"
msgstr ""
#: ../../whatsnew/2.4.rst:200
msgid ""
"If a key is missing from the dictionary, the :meth:`substitute` method will "
"raise a :exc:`KeyError`. There's also a :meth:`safe_substitute` method that "
"ignores missing keys::"
msgstr ""
"辞書にキーが見つからない場合、 :meth:`substitute` メソッドは :exc:`KeyError` "
"を送出します。 :meth:`safe_substitute` メソッドもあり、これはキー不在を無視し"
"ます::"
#: ../../whatsnew/2.4.rst:204
msgid ""
">>> t = string.Template('$page: $title')\n"
">>> t.safe_substitute({'page':3})\n"
"'3: $title'"
msgstr ""
#: ../../whatsnew/2.4.rst:211
msgid ":pep:`292` - Simpler String Substitutions"
msgstr ":pep:`292` - より単純な文字列置換 (string substitution)"
#: ../../whatsnew/2.4.rst:212
msgid "Written and implemented by Barry Warsaw."
msgstr "Barry Warsaw 著、実装"
#: ../../whatsnew/2.4.rst:218
msgid "PEP 318: Decorators for Functions and Methods"
msgstr "PEP 318: 関数とメソッドのためのデコレータ"
#: ../../whatsnew/2.4.rst:220
msgid ""
"Python 2.2 extended Python's object model by adding static methods and class "
"methods, but it didn't extend Python's syntax to provide any new way of "
"defining static or class methods. Instead, you had to write a :keyword:"
"`def` statement in the usual way, and pass the resulting method to a :func:"
"`staticmethod` or :func:`classmethod` function that would wrap up the "
"function as a method of the new type. Your code would look like this::"
msgstr ""
"Python 2.2 は Python オブジェクトモデルを静的メソッド、クラスメソッドを追加す"
"ることで拡張はしましたが、それらを定義する新たな手段を提供するような Python "
"構文の拡張はしませんでした。このため、 :keyword:`def` でメソッドは普通に書い"
"たのち、新型メソッドとしての関数へ仕立て上げる :func:`staticmethod` または :"
"func:`classmethod` にその結果のメソッドを渡す、という手順を取る必要がありまし"
"た。このような具合でした::"
#: ../../whatsnew/2.4.rst:227
msgid ""
"class C:\n"
" def meth (cls):\n"
" ...\n"
"\n"
" meth = classmethod(meth) # Rebind name to wrapped-up class method"
msgstr ""
#: ../../whatsnew/2.4.rst:233
msgid ""
"If the method was very long, it would be easy to miss or forget the :func:"
"`classmethod` invocation after the function body."
msgstr ""
"メソッドがとても長かったりすると、関数のボディの後ろの :func:`classmethod` 呼"
"び出しは見失ったり忘れたりしやすいものでした。"
#: ../../whatsnew/2.4.rst:236
msgid ""
"The intention was always to add some syntax to make such definitions more "
"readable, but at the time of 2.2's release a good syntax was not obvious. "
"Today a good syntax *still* isn't obvious but users are asking for easier "
"access to the feature; a new syntactic feature has been added to meet this "
"need."
msgstr ""
"そのような定義をもっと読みやすくするために何か構文を追加する、という意図は常"
"にありましたが、2.2 のリリース時点では良い構文は明らかではありませんでした。"
"本日時点でさえ *いまだ* 明らかとは言えませんが、ユーザは静的メソッドとクラス"
"メソッドを簡単に手にする手段を注文し続けています; 新たな構文的機能はこの要求"
"に合うように追加されました。"
#: ../../whatsnew/2.4.rst:241
msgid ""
"The new feature is called \"function decorators\". The name comes from the "
"idea that :func:`classmethod`, :func:`staticmethod`, and friends are storing "
"additional information on a function object; they're *decorating* functions "
"with more details."
msgstr ""
"この新たな機能は「関数デコレータ (function decorators)」と呼ばれます。この名"
"前は :func:`classmethod`, :func:`staticmethod`, とその仲間たちが関数オブジェ"
"クトに追加的な情報を保存することから着想を得たものです; それらは関数をより多"
"くの詳細で *デコレート (修飾) している* というわけです。"
#: ../../whatsnew/2.4.rst:246
msgid ""
"The notation borrows from Java and uses the ``'@'`` character as an "
"indicator. Using the new syntax, the example above would be written::"
msgstr ""
"記法は Java より拝借して ``'@'`` 文字を指示子として使います。この新たな構文を"
"使うと、上記の例はこのように書けます::"
#: ../../whatsnew/2.4.rst:249
msgid ""
"class C:\n"
"\n"
" @classmethod\n"
" def meth (cls):\n"
" ..."
msgstr ""
#: ../../whatsnew/2.4.rst:256
msgid ""
"The ``@classmethod`` is shorthand for the ``meth=classmethod(meth)`` "
"assignment. More generally, if you have the following::"
msgstr ""
"``@classmethod`` は ``meth=classmethod(meth)`` 代入の速記法です。より一般的に"
"は、このように書けば…:"
#: ../../whatsnew/2.4.rst:259
msgid ""
"@A\n"
"@B\n"
"@C\n"
"def f ():\n"
" ..."
msgstr ""
#: ../../whatsnew/2.4.rst:265
msgid "It's equivalent to the following pre-decorator code::"
msgstr "これはデコレータ前史の以下コードと等価です::"
#: ../../whatsnew/2.4.rst:267
msgid ""
"def f(): ...\n"
"f = A(B(C(f)))"
msgstr ""
#: ../../whatsnew/2.4.rst:270
msgid ""
"Decorators must come on the line before a function definition, one decorator "
"per line, and can't be on the same line as the def statement, meaning that "
"``@A def f(): ...`` is illegal. You can only decorate function definitions, "
"either at the module level or inside a class; you can't decorate class "
"definitions."
msgstr ""
"デコレータは関数定義の前になければなりません。一行ごとに一つのデコレータで"
"す。 def ステートメントと同じ行にあってはダメです。つまり ``@A def f(): ..."
"`` は不正です。モジュールレベルかクラス内の関数定義のみをデコレート出来ます; "
"クラス定義はデコレート出来ません。(--- 訳注: クラス定義のデコレータは Python "
"2.6 で追加されました (PEP 3129) 。---)"
#: ../../whatsnew/2.4.rst:275
msgid ""
"A decorator is just a function that takes the function to be decorated as an "
"argument and returns either the same function or some new object. The "
"return value of the decorator need not be callable (though it typically is), "
"unless further decorators will be applied to the result. It's easy to write "
"your own decorators. The following simple example just sets an attribute on "
"the function object::"
msgstr ""
"デコレータはただの関数です。引数としてデコレートされる関数を取り、同じ関数か"
"何か新しいオブジェクトを返すだけの。結果がほかのデコレータ適用されるの出ない"
"限りは、デコレータの戻り値は呼び出し可能である必要はありません (普通はそうで"
"すが)。あなた自身のデコレータを書くのは簡単です。続く単純な例は、関数オブジェ"
"クトに単に属性をセットするだけのものです::"
#: ../../whatsnew/2.4.rst:282
msgid ""
">>> def deco(func):\n"
"... func.attr = 'decorated'\n"
"... return func\n"
"...\n"
">>> @deco\n"
"... def f(): pass\n"
"...\n"
">>> f\n"
"<function f at 0x402ef0d4>\n"
">>> f.attr\n"
"'decorated'\n"
">>>"
msgstr ""
#: ../../whatsnew/2.4.rst:295
msgid ""
"As a slightly more realistic example, the following decorator checks that "
"the supplied argument is an integer::"
msgstr ""
"もう少しだけ現実的な例として、続く例ではデコレータに、与えられた引数が整数か"
"どうかチェックさせてみます::"
#: ../../whatsnew/2.4.rst:298
msgid ""
"def require_int (func):\n"
" def wrapper (arg):\n"
" assert isinstance(arg, int)\n"
" return func(arg)\n"
"\n"
" return wrapper\n"
"\n"
"@require_int\n"
"def p1 (arg):\n"
" print arg\n"
"\n"
"@require_int\n"
"def p2(arg):\n"
" print arg*2"
msgstr ""
#: ../../whatsnew/2.4.rst:313
msgid ""
"An example in :pep:`318` contains a fancier version of this idea that lets "
"you both specify the required type and check the returned type."
msgstr ""
":pep:`318` にある例はこのアイディアのもっと凝った版が含まれていて、それは要求"
"型の指定と戻り値のチェックの両方が出来ます。"
#: ../../whatsnew/2.4.rst:316
msgid ""
"Decorator functions can take arguments. If arguments are supplied, your "
"decorator function is called with only those arguments and must return a new "
"decorator function; this function must take a single function and return a "
"function, as previously described. In other words, ``@A @B @C(args)`` "
"becomes::"
msgstr ""
"デコレータ関数は引数を取ることが出来ます。引数が与えられた場合、あなたのデコ"
"レータ関数はそれら引数のみで呼び出され、そして新しいデコレータを返さなければ"
"なりません; この関数は単一の関数を取らなければならず、前述のように関数を返さ"
"なければなりません。言い換えると、 ``@A @B @C(args)`` はこうなります::"
#: ../../whatsnew/2.4.rst:321
msgid ""
"def f(): ...\n"
"_deco = C(args)\n"
"f = A(B(_deco(f)))"
msgstr ""
#: ../../whatsnew/2.4.rst:325
msgid ""
"Getting this right can be slightly brain-bending, but it's not too difficult."
msgstr ""
"これが正しいと理解するには少しばかり頭をひねる必要がありますが、難しすぎるこ"
"とはありません。"
#: ../../whatsnew/2.4.rst:327
msgid ""
"A small related change makes the :attr:`func_name <function.__name__>` "
"attribute of functions writable. This attribute is used to display function "
"names in tracebacks, so decorators should change the name of any new "
"function that's constructed and returned."
msgstr ""
#: ../../whatsnew/2.4.rst:336
msgid ":pep:`318` - Decorators for Functions, Methods and Classes"
msgstr ":pep:`318` - 関数、メソッド、クラスのためのデコレータ"
#: ../../whatsnew/2.4.rst:337
msgid ""
"Written by Kevin D. Smith, Jim Jewett, and Skip Montanaro. Several people "
"wrote patches implementing function decorators, but the one that was "
"actually checked in was patch #979728, written by Mark Russell."
msgstr ""
"Kevin D. Smith, Jim Jewett, Skip Montanaro により著されました。数多くの人々が"
"関数デコレータ実装のパッチを書きましたが、実際にチェックインされたものは "
"Mark Russell が書いた #979728 でした。"
#: ../../whatsnew/2.4.rst:341
msgid "https://wiki.python.org/moin/PythonDecoratorLibrary"
msgstr "https://wiki.python.org/moin/PythonDecoratorLibrary"
#: ../../whatsnew/2.4.rst:342
msgid "This Wiki page contains several examples of decorators."
msgstr "数多くのデコレータ例を含む Wiki ページ。"
#: ../../whatsnew/2.4.rst:348
msgid "PEP 322: Reverse Iteration"
msgstr "PEP 322: 逆順のイテレーション"
#: ../../whatsnew/2.4.rst:350
msgid ""
"A new built-in function, ``reversed(seq)``, takes a sequence and returns an "
"iterator that loops over the elements of the sequence in reverse order. ::"
msgstr ""
"新しいビルトイン関数 ``reversed(seq)`` は、シーケンスを受け取って、シーケンス"
"の要素を逆順にループするイテレータを返します::"
#: ../../whatsnew/2.4.rst:353
msgid ""
">>> for i in reversed(xrange(1,4)):\n"
"... print i\n"
"...\n"
"3\n"
"2\n"
"1"
msgstr ""
#: ../../whatsnew/2.4.rst:360
msgid ""
"Compared to extended slicing, such as ``range(1,4)[::-1]``, :func:`reversed` "
"is easier to read, runs faster, and uses substantially less memory."
msgstr ""
"``range(1,4)[::-1]`` のようにする拡張スライスでのやり方に比較して :func:"
"`reversed` は読みやすく、実行が高速で、大体の場合はメモリ使用が少なく済みま"
"す。"
#: ../../whatsnew/2.4.rst:363
msgid ""
"Note that :func:`reversed` only accepts sequences, not arbitrary iterators. "
"If you want to reverse an iterator, first convert it to a list with :func:"
"`list`. ::"
msgstr ""
":func:`reversed` は任意のイテレータは受け付けず、シーケンスのみ受け付けること"
"に注意してください。イテレータを逆順にしたければ、最初に :func:`list` でリス"
"トに変換してください::"
#: ../../whatsnew/2.4.rst:367
msgid ""
">>> input = open('/etc/passwd', 'r')\n"
">>> for line in reversed(list(input)):\n"
"... print line\n"
"...\n"
"root:*:0:0:System Administrator:/var/root:/bin/tcsh\n"
" ..."
msgstr ""
#: ../../whatsnew/2.4.rst:377
msgid ":pep:`322` - Reverse Iteration"
msgstr ":pep:`322` - 逆順のイテレーション"
#: ../../whatsnew/2.4.rst:378
msgid "Written and implemented by Raymond Hettinger."
msgstr "Raymond Hettinger 著、実装."
#: ../../whatsnew/2.4.rst:384
msgid "PEP 324: New subprocess Module"
msgstr "PEP 324: 新しい subprocess モジュール"
#: ../../whatsnew/2.4.rst:386
msgid ""
"The standard library provides a number of ways to execute a subprocess, "
"offering different features and different levels of complexity. ``os."
"system(command)`` is easy to use, but slow (it runs a shell process which "
"executes the command) and dangerous (you have to be careful about escaping "
"the shell's metacharacters). The :mod:`!popen2` module offers classes that "
"can capture standard output and standard error from the subprocess, but the "
"naming is confusing. The :mod:`subprocess` module cleans this up, "
"providing a unified interface that offers all the features you might need."
msgstr ""
#: ../../whatsnew/2.4.rst:395
msgid ""
"Instead of :mod:`!popen2`'s collection of classes, :mod:`subprocess` "
"contains a single class called :class:`subprocess.Popen` whose constructor "
"supports a number of different keyword arguments. ::"
msgstr ""
#: ../../whatsnew/2.4.rst:399
msgid ""
"class Popen(args, bufsize=0, executable=None,\n"
" stdin=None, stdout=None, stderr=None,\n"
" preexec_fn=None, close_fds=False, shell=False,\n"
" cwd=None, env=None, universal_newlines=False,\n"
" startupinfo=None, creationflags=0):"
msgstr ""
#: ../../whatsnew/2.4.rst:405
msgid ""
"*args* is commonly a sequence of strings that will be the arguments to the "
"program executed as the subprocess. (If the *shell* argument is true, "
"*args* can be a string which will then be passed on to the shell for "
"interpretation, just as :func:`os.system` does.)"
msgstr ""
"*args* は普通は文字列のシーケンスで、サブプロセスとして実行するプログラムへの"
"引数群となります。 (*shell* 引数が真の場合は *args* はシェルに解釈を任せるた"
"めに渡す文字列に出来、つまりこの場合 :func:`os.system` と同じことをします。)"
#: ../../whatsnew/2.4.rst:410
msgid ""
"*stdin*, *stdout*, and *stderr* specify what the subprocess's input, output, "
"and error streams will be. You can provide a file object or a file "
"descriptor, or you can use the constant ``subprocess.PIPE`` to create a pipe "
"between the subprocess and the parent."
msgstr ""
"*stdin*, *stdout*, *stderr* はサブプロセスの入力・出力・エラーのストリームを"
"指定します。ファイルオブジェクトかファイル記述子を渡すことが出来ます。あるい"
"は定数 ``subprocess.PIPE`` を渡してサブプロセスと親とのパイプを作成することが"
"出来ます。"
#: ../../whatsnew/2.4.rst:418
msgid "The constructor has a number of handy options:"
msgstr "コンストラクタには多くの便利なオプションがあります:"
#: ../../whatsnew/2.4.rst:420
msgid ""
"*close_fds* requests that all file descriptors be closed before running the "
"subprocess."
msgstr ""
"*close_fds* はサブプロセス実行前に全てのファイル記述子をクローズすることを要"
"求します。"
#: ../../whatsnew/2.4.rst:423
msgid ""
"*cwd* specifies the working directory in which the subprocess will be "
"executed (defaulting to whatever the parent's working directory is)."
msgstr ""
"*cwd* はサブプロセスを実行する作業ディレクトリを指定します (デフォルトは親の"
"作業ディレクトリです)。"
#: ../../whatsnew/2.4.rst:426
msgid "*env* is a dictionary specifying environment variables."
msgstr "*env* は環境変数を指定する辞書です。"
#: ../../whatsnew/2.4.rst:428
msgid ""
"*preexec_fn* is a function that gets called before the child is started."
msgstr "*preexec_fn* は子が開始する前に呼び出される関数です。"
#: ../../whatsnew/2.4.rst:430
msgid ""
"*universal_newlines* opens the child's input and output using Python's :term:"
"`universal newlines` feature."
msgstr ""
"*universal_newlines* で、子の入出力を、Python の :term:`universal newlines` "
"機能で開きます。"
#: ../../whatsnew/2.4.rst:433
msgid ""
"Once you've created the :class:`Popen` instance, you can call its :meth:"
"`wait` method to pause until the subprocess has exited, :meth:`poll` to "
"check if it's exited without pausing, or ``communicate(data)`` to send the "
"string *data* to the subprocess's standard input. ``communicate(data)`` "
"then reads any data that the subprocess has sent to its standard output or "
"standard error, returning a tuple ``(stdout_data, stderr_data)``."
msgstr ""
":class:`Popen` インスタンスを作ってしまえば、あとはサブプロセスが終了するまで"
"停止するために :meth:`wait` メソッド呼び出すことが出来、停止することなく終了"
"をチェックするのに :meth:`poll` メソッドを呼び出すことが出来、あるいは "
"``communicate(data)`` を呼び出して、子の標準入力に *data* を送信することが出"
"来ます。 ``communicate(data)`` はサブプロセスが送信する標準出力と標準エラー出"
"力を読み込み、タプル ``(stdout_data, stderr_data)`` を返します。"
#: ../../whatsnew/2.4.rst:440
msgid ""
":func:`call` is a shortcut that passes its arguments along to the :class:"
"`Popen` constructor, waits for the command to complete, and returns the "
"status code of the subprocess. It can serve as a safer analog to :func:`os."
"system`::"
msgstr ""
":func:`call` は :class:`Popen` コンストラクタにその引数を流し込むショートカッ"
"トで、コマンドが終了するまで待ち、サブプロセスの終了コードを返します。これ"
"は :func:`os.system` に対する安全な置き換えとなりえます::"
#: ../../whatsnew/2.4.rst:444
msgid ""
"sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\n"
"if sts == 0:\n"
" # Success\n"
" ...\n"
"else:\n"
" # dpkg returned an error\n"
" ..."
msgstr ""
#: ../../whatsnew/2.4.rst:452
msgid ""
"The command is invoked without use of the shell. If you really do want to "
"use the shell, you can add ``shell=True`` as a keyword argument and provide "
"a string instead of a sequence::"
msgstr ""
"コマンドはシェルを使うことなく呼び出されます。もしシェルを本当に使いたいので"
"あればキーワード引数として ``shell=True`` を与えた上でシーケンスの代わりに文"
"字列を与えることが出来ます::"
#: ../../whatsnew/2.4.rst:456
msgid "sts = subprocess.call('dpkg -i /tmp/new-package.deb', shell=True)"
msgstr ""
#: ../../whatsnew/2.4.rst:458
msgid ""
"The PEP takes various examples of shell and Python code and shows how they'd "
"be translated into Python code that uses :mod:`subprocess`. Reading this "
"section of the PEP is highly recommended."
msgstr ""
"PEP にはシェルと Python コードの様々な例が採られていて、シェルスクリプトをい"
"かにして :mod:`subprocess` を用いて Python コードに変換するかを示しています。"
"PEP のこのセクションを読むことを強くお勧めします。"
#: ../../whatsnew/2.4.rst:465
msgid ":pep:`324` - subprocess - New process module"
msgstr ":pep:`324` - subprocess - プロセスのための新たなモジュール"
#: ../../whatsnew/2.4.rst:466
msgid ""
"Written and implemented by Peter Åstrand, with assistance from Fredrik Lundh "
"and others."
msgstr ""
"Fredrik Lundh 他によるサポートによって、Peter Åstrand により PEP 著と実装が行"
"われました。"
#: ../../whatsnew/2.4.rst:473
msgid "PEP 327: Decimal Data Type"
msgstr "PEP 327: Decimal データ型"
#: ../../whatsnew/2.4.rst:475
msgid ""
"Python has always supported floating-point (FP) numbers, based on the "
"underlying C :c:expr:`double` type, as a data type. However, while most "
"programming languages provide a floating-point type, many people (even "
"programmers) are unaware that floating-point numbers don't represent certain "
"decimal fractions accurately. The new :class:`Decimal` type can represent "
"these fractions accurately, up to a user-specified precision limit."
msgstr ""
#: ../../whatsnew/2.4.rst:484
msgid "Why is Decimal needed?"
msgstr "なぜ Decimal が必要なのか?"
#: ../../whatsnew/2.4.rst:486
msgid ""
"The limitations arise from the representation used for floating-point "
"numbers. FP numbers are made up of three components:"
msgstr ""
"浮動小数点数が使う表現方法に起因する制約があります。浮動小数点数は 3 つの構成"
"要素から成ります:"
#: ../../whatsnew/2.4.rst:489
msgid "The sign, which is positive or negative."
msgstr "符号(sign)。正または負。"
#: ../../whatsnew/2.4.rst:491
msgid ""
"The mantissa, which is a single-digit binary number followed by a "
"fractional part. For example, ``1.01`` in base-2 notation is ``1 + 0/2 + "
"1/4``, or 1.25 in decimal notation."
msgstr ""
"仮数部(mantissa)。一桁の 2 進値に端数部が続きます。例えば 2 進数で ``1.01`` "
"は ``1 + 0/2 + 1/4`` で 10 進表記で 1.25 です。"
#: ../../whatsnew/2.4.rst:495
msgid ""
"The exponent, which tells where the decimal point is located in the number "
"represented."
msgstr "指数部(exponent)。小数点がその数値のどこに位置するかを表します。"
#: ../../whatsnew/2.4.rst:498
msgid ""
"For example, the number 1.25 has positive sign, a mantissa value of 1.01 (in "
"binary), and an exponent of 0 (the decimal point doesn't need to be "
"shifted). The number 5 has the same sign and mantissa, but the exponent is 2 "
"because the mantissa is multiplied by 4 (2 to the power of the exponent 2); "
"1.25 \\* 4 equals 5."
msgstr ""
"例えば 1.25 は、正の符号を持ち、仮数部の値は (2 進数で) 1.01 で、指数部は 0 "
"です (小数点は移動の必要がありません)。5 は同じ符号と仮数部を持ち、指数部は、"
"仮数部が 4 倍なので 2 (2 を底とする 2 の 冪乗) です; 1.25 \\* 4 は 5 です。"
#: ../../whatsnew/2.4.rst:504
msgid ""
"Modern systems usually provide floating-point support that conforms to a "
"standard called IEEE 754. C's :c:expr:`double` type is usually implemented "
"as a 64-bit IEEE 754 number, which uses 52 bits of space for the mantissa. "
"This means that numbers can only be specified to 52 bits of precision. If "
"you're trying to represent numbers whose expansion repeats endlessly, the "
"expansion is cut off after 52 bits. Unfortunately, most software needs to "
"produce output in base 10, and common fractions in base 10 are often "
"repeating decimals in binary. For example, 1.1 decimal is binary "
"``1.0001100110011 ...``; .1 = 1/16 + 1/32 + 1/256 plus an infinite number of "
"additional terms. IEEE 754 has to chop off that infinitely repeated decimal "
"after 52 digits, so the representation is slightly inaccurate."
msgstr ""
#: ../../whatsnew/2.4.rst:516
msgid "Sometimes you can see this inaccuracy when the number is printed::"
msgstr "ときどきあなたはこの不正確さを、数値を表示する際に目にするでしょう::"
#: ../../whatsnew/2.4.rst:518
msgid ""
">>> 1.1\n"
"1.1000000000000001"
msgstr ""
#: ../../whatsnew/2.4.rst:521
msgid ""
"The inaccuracy isn't always visible when you print the number because the FP-"
"to-decimal-string conversion is provided by the C library, and most C "
"libraries try to produce sensible output. Even if it's not displayed, "
"however, the inaccuracy is still there and subsequent operations can magnify "
"the error."
msgstr ""
"この不正確さは数値を表示する際にいつでも目に見えるわけではありません。浮動小"
"数点数から文字列への変換が C ライブラリによって提供されていて、C ライブラリの"
"ほとんどが賢明な出力を生成しようと頑張っているからです。それが表示されないに"
"しても、不正確さはそれでも存在していて、後続の計算への誤差が大きくなりえま"
"す。"
#: ../../whatsnew/2.4.rst:526
msgid ""
"For many applications this doesn't matter. If I'm plotting points and "
"displaying them on my monitor, the difference between 1.1 and "
"1.1000000000000001 is too small to be visible. Reports often limit output "
"to a certain number of decimal places, and if you round the number to two or "
"three or even eight decimal places, the error is never apparent. However, "
"for applications where it does matter, it's a lot of work to implement your "
"own custom arithmetic routines."
msgstr ""
"多くのアプリケーションではこれは重要ではありません。モニタにプロットして表示"
"するのに 1.1 と 1.1000000000000001 の差は小さすぎて見えません。大抵は出力を一"
"定の桁位置までに制限して出力するものですし、2 やら 3 やら 8 桁などの位置で丸"
"めたりすれば誤差は決して露わにはなりません。ですがそれが重要なアプリケーショ"
"ンにとっては、あなた自身のカスタム数学ルーチンのための実装作業は膨大になりま"
"す。"
#: ../../whatsnew/2.4.rst:534
msgid "Hence, the :class:`Decimal` type was created."
msgstr "こうして :class:`Decimal` 型が作られました。"
#: ../../whatsnew/2.4.rst:538
msgid "The :class:`Decimal` type"
msgstr ":class:`Decimal` 型"
#: ../../whatsnew/2.4.rst:540
msgid ""
"A new module, :mod:`decimal`, was added to Python's standard library. It "
"contains two classes, :class:`Decimal` and :class:`Context`. :class:"
"`Decimal` instances represent numbers, and :class:`Context` instances are "
"used to wrap up various settings such as the precision and default rounding "
"mode."
msgstr ""
"新しいモジュール :mod:`decimal` が Python 標準ライブラリに追加されました。こ"
"れには 2 つのクラス :class:`Decimal`, :class:`Context` を含みます。 :class:"
"`Decimal` インスタンスは数値を表現し、 :class:`Context` インスタンスは、精度"