-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathintroduction.po
More file actions
779 lines (694 loc) · 40.8 KB
/
introduction.po
File metadata and controls
779 lines (694 loc) · 40.8 KB
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
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 1990-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# 秘湯 <xwhhsprings@gmail.com>, 2015-2016
msgid ""
msgstr ""
"Project-Id-Version: Python 2.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-01 01:01+0900\n"
"PO-Revision-Date: 2019-09-01 05:18+0000\n"
"Last-Translator: tomo\n"
"Language-Team: Japanese (http://www.transifex.com/python-doc/python-27/"
"language/ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../tutorial/introduction.rst:5
msgid "An Informal Introduction to Python"
msgstr "形式ばらない Python の紹介"
#: ../../tutorial/introduction.rst:7
msgid ""
"In the following examples, input and output are distinguished by the "
"presence or absence of prompts (:term:`>>>` and :term:`...`): to repeat the "
"example, you must type everything after the prompt, when the prompt appears; "
"lines that do not begin with a prompt are output from the interpreter. Note "
"that a secondary prompt on a line by itself in an example means you must "
"type a blank line; this is used to end a multi-line command."
msgstr ""
"以下の例では、入力と出力は (:term:`>>>` や :term:`...`) といったプロンプトの"
"有無で区別します: 例を実際に試してみるためには、プロンプトが表示されていると"
"きに、例中のプロンプトから後ろの内容全てを入力しなければなりません; プロンプ"
"トが先頭にない行はインタプリタからの出力です。例中には2つ目のプロンプトだけが"
"表示されている行がありますが、これは空行を入力しなければならないことを意味し"
"ています; 空行の入力は複数の行からなる命令の終わりをインタプリタに教えるため"
"に使われます。"
#: ../../tutorial/introduction.rst:14
msgid ""
"Many of the examples in this manual, even those entered at the interactive "
"prompt, include comments. Comments in Python start with the hash character, "
"``#``, and extend to the end of the physical line. A comment may appear at "
"the start of a line or following whitespace or code, but not within a string "
"literal. A hash character within a string literal is just a hash character. "
"Since comments are to clarify code and are not interpreted by Python, they "
"may be omitted when typing in examples."
msgstr ""
"このマニュアルにある例の多くは、対話プロンプトで入力されるものでもコメントを"
"含んでいます。 Python におけるコメント文はハッシュ文字 ``#`` で始まり、物理行"
"の終わりまで続きます。コメントは行の先頭にも、空白やコードの後にも書くことが"
"できますが、文字列リテラルの内部に置くことはできません。文字列リテラル中の"
"ハッシュ文字はただのハッシュ文字です。コメントはコードを明快にするためのもの"
"であり、Pythonはコメントを解釈しません。なので、コードサンプルを実際に入力し"
"て試して見るときは、コメントをを省いても大丈夫です。"
#: ../../tutorial/introduction.rst:22
msgid "Some examples::"
msgstr "幾つかの例です::"
#: ../../tutorial/introduction.rst:33
msgid "Using Python as a Calculator"
msgstr "Python を電卓として使う"
#: ../../tutorial/introduction.rst:35
msgid ""
"Let's try some simple Python commands. Start the interpreter and wait for "
"the primary prompt, ``>>>``. (It shouldn't take long.)"
msgstr ""
"それでは、簡単な Python コマンドをいくつか試しましょう。インタプリタを起動し"
"て、一次プロンプト、 ``>>>`` が現れるのを待ちます。 (そう長くはかからないはず"
"です)"
#: ../../tutorial/introduction.rst:42
msgid "Numbers"
msgstr "数"
#: ../../tutorial/introduction.rst:44
msgid ""
"The interpreter acts as a simple calculator: you can type an expression at "
"it and it will write the value. Expression syntax is straightforward: the "
"operators ``+``, ``-``, ``*`` and ``/`` work just like in most other "
"languages (for example, Pascal or C); parentheses (``()``) can be used for "
"grouping. For example::"
msgstr ""
"インタプリタは単純な電卓のように動作します: 式を入力すると、その結果が表示さ"
"れます。式の文法は素直なものです: 演算子 ``+``, ``-``, ``*``, ``/`` は "
"(Pascal や C といった) 他のほとんどの言語と同じように動作します; 丸括弧 "
"(``()``) をグループ化に使うこともできます。例えば::"
#: ../../tutorial/introduction.rst:59
msgid ""
"The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the "
"ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:"
"`float`. We will see more about numeric types later in the tutorial."
msgstr ""
"整数 (例えば、 ``2`` 、 ``4`` 、 ``20``) は :class:`int` 型を持ち、小数部を持"
"つ数 (例えば、 ``5.0`` 、 ``1.6``) は :class:`float` 型を持ちます。数値型につ"
"いては後のチュートリアルでさらに見ていきます。"
#: ../../tutorial/introduction.rst:63
msgid ""
"The return type of a division (``/``) operation depends on its operands. If "
"both operands are of type :class:`int`, :term:`floor division` is performed "
"and an :class:`int` is returned. If either operand is a :class:`float`, "
"classic division is performed and a :class:`float` is returned. The ``//`` "
"operator is also provided for doing floor division no matter what the "
"operands are. The remainder can be calculated with the ``%`` operator::"
msgstr ""
"割り算 (``/``) の戻り値は、その被演算子に依存します。被演算子の両方が :class:"
"`int` 型ならば、 :term:`floor division` が計算されて :class:`int` が返りま"
"す。被演算子のどちらかが :class:`float` の場合は良く知られた方の割り算が計算"
"されて、 :class:`float` が返ります。 ``//`` 演算子も :term:`floor division` "
"を計算しますが、被演算子によりません。剰余は ``%`` 演算子で計算出来ます ::"
#: ../../tutorial/introduction.rst:81
msgid ""
"With Python, it is possible to use the ``**`` operator to calculate powers "
"[#]_::"
msgstr "Python では、冪乗を計算するのに ``**`` 演算子が使えます [#]_::"
#: ../../tutorial/introduction.rst:88
msgid ""
"The equal sign (``=``) is used to assign a value to a variable. Afterwards, "
"no result is displayed before the next interactive prompt::"
msgstr ""
"等号 (``=``) は変数に値を代入するときに使います。代入を行っても、次のプロンプ"
"トの手前には結果は出力されません::"
#: ../../tutorial/introduction.rst:96
msgid ""
"If a variable is not \"defined\" (assigned a value), trying to use it will "
"give you an error::"
msgstr ""
"変数が \"定義\" されて (つまり値が代入されて) いない場合、その変数を使おうと"
"するとエラーが発生します::"
#: ../../tutorial/introduction.rst:104
msgid ""
"There is full support for floating point; operators with mixed type operands "
"convert the integer operand to floating point::"
msgstr ""
"浮動小数点を完全にサポートしています。演算対象の値(オペランド)の型が統一され"
"ていない場合、演算子は整数のオペランドを浮動小数点型に変換します::"
#: ../../tutorial/introduction.rst:112
msgid ""
"In interactive mode, the last printed expression is assigned to the variable "
"``_``. This means that when you are using Python as a desk calculator, it "
"is somewhat easier to continue calculations, for example::"
msgstr ""
"対話モードでは、最後に表示された結果は変数 ``_`` に代入されます。このことを利"
"用すると、Python を電卓として使うときに、計算を連続して行う作業が多少楽になり"
"ます。以下に例を示します::"
#: ../../tutorial/introduction.rst:125
msgid ""
"This variable should be treated as read-only by the user. Don't explicitly "
"assign a value to it --- you would create an independent local variable with "
"the same name masking the built-in variable with its magic behavior."
msgstr ""
"ユーザはこの変数を読取り専用の値として扱うべきです。この変数に明示的な代入を"
"行ってはいけません --- そんなことをすれば、同じ名前で元の特別な動作をする組み"
"込み変数を覆い隠してしまうような、別のローカルな変数が生成されてしまいます。"
#: ../../tutorial/introduction.rst:129
msgid ""
"In addition to :class:`int` and :class:`float`, Python supports other types "
"of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions."
"Fraction`. Python also has built-in support for :ref:`complex numbers "
"<typesnumeric>`, and uses the ``j`` or ``J`` suffix to indicate the "
"imaginary part (e.g. ``3+5j``)."
msgstr ""
":class:`int` と :class:`float` に加え、 Python は :class:`~decimal.Decimal` "
"や :class:`~fractions.Fraction` のような他の数値型をサポートしています。 "
"Python はビルトインで :ref:`複素数 <typesnumeric>` もサポートし、 ``j`` もし"
"くは ``J`` 接尾辞を使って虚部を示します (例。 ``3+5j``)。"
#: ../../tutorial/introduction.rst:139
msgid "Strings"
msgstr "文字列"
#: ../../tutorial/introduction.rst:141
msgid ""
"Besides numbers, Python can also manipulate strings, which can be expressed "
"in several ways. They can be enclosed in single quotes (``'...'``) or "
"double quotes (``\"...\"``) with the same result [#]_. ``\\`` can be used "
"to escape quotes::"
msgstr ""
"数のほかに、Python は文字列の操作ができ、文字列はいくつもの方法で表現できま"
"す。文字列は単引用符 (``'...'``) もしくは二重引用符 (``\"...\"``) で囲み、結"
"果はどちらも同じ文字列になります。[#]_ ``\\`` は引用符をエスケープするのに使"
"います::"
#: ../../tutorial/introduction.rst:159
msgid ""
"In the interactive interpreter, the output string is enclosed in quotes and "
"special characters are escaped with backslashes. While this might sometimes "
"look different from the input (the enclosing quotes could change), the two "
"strings are equivalent. The string is enclosed in double quotes if the "
"string contains a single quote and no double quotes, otherwise it is "
"enclosed in single quotes. The :keyword:`print` statement produces a more "
"readable output, by omitting the enclosing quotes and by printing escaped "
"and special characters::"
msgstr ""
"対話的インタプリタでは、出力文字列は引用符に囲まれ、特殊文字はバックスラッ"
"シュでエスケープされます。これは入力とは違って見える (囲っている引用符が変わ"
"る) こともありますが、その 2 つの文字列は同じ文字列です。文字列が単引用符を含"
"み二重引用符を含まない場合、二重引用符で囲われ、それ以外の場合は単引用符で囲"
"われます。:keyword:`print` キーワードは、囲っている引用符を落とし、エスケープ"
"した特殊文字を出力することで、より読み易い出力を作成します::"
#: ../../tutorial/introduction.rst:179
msgid ""
"If you don't want characters prefaced by ``\\`` to be interpreted as special "
"characters, you can use *raw strings* by adding an ``r`` before the first "
"quote::"
msgstr ""
"特殊文字として解釈させるために文字の前に ``\\`` を付けることをしたくない場合"
"は、最初の引用符の前に ``r`` を付けた *raw strings* が使えます::"
#: ../../tutorial/introduction.rst:189
msgid ""
"String literals can span multiple lines. One way is using triple-quotes: "
"``\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically "
"included in the string, but it's possible to prevent this by adding a ``\\`` "
"at the end of the line. The following example::"
msgstr ""
"文字列リテラルは複数行にまたがって書けます。1 つの方法は三連引用符 "
"(``\"\"\"...\"\"\"`` や ``'''...'''``) を使うことです。行末は自動的に文字列に"
"含まれますが、行末に ``\\`` を付けることで含めないようにすることもできます。"
"次の例::"
#: ../../tutorial/introduction.rst:200
msgid ""
"produces the following output (note that the initial newline is not "
"included):"
msgstr ""
"は次のような出力になります (最初の改行文字は含まれていないことに注意してくだ"
"さい):"
#: ../../tutorial/introduction.rst:208
msgid ""
"Strings can be concatenated (glued together) with the ``+`` operator, and "
"repeated with ``*``::"
msgstr ""
"文字列は ``+`` 演算子で連結させる (くっつけて一つにする) ことができ、``*`` 演"
"算子で反復させることができます::"
#: ../../tutorial/introduction.rst:215
msgid ""
"Two or more *string literals* (i.e. the ones enclosed between quotes) next "
"to each other are automatically concatenated. ::"
msgstr ""
"連続して並んでいる複数の *文字列リテラル* (つまり、引用符に囲われた文字列) は"
"自動的に連結されます。 ::"
#: ../../tutorial/introduction.rst:221
msgid ""
"This feature is particularly useful when you want to break long strings::"
msgstr "この機能は特に、長い文字列を改行したいときに役に立ちます::"
#: ../../tutorial/introduction.rst:228
msgid ""
"This only works with two literals though, not with variables or expressions::"
msgstr "これは 2 つのリテラルどうしに対してのみ働き、変数や式には働きません::"
#: ../../tutorial/introduction.rst:238
msgid ""
"If you want to concatenate variables or a variable and a literal, use ``+``::"
msgstr "変数どうしや変数とリテラルを連結したい場合は、``+`` を使ってください::"
#: ../../tutorial/introduction.rst:243
msgid ""
"Strings can be *indexed* (subscripted), with the first character having "
"index 0. There is no separate character type; a character is simply a string "
"of size one::"
msgstr ""
"文字列は *インデクス表記* (添字表記) することができ、最初の文字のインデクス"
"は 0 になります。文字列型と区別された文字型はありません; 文字というのは単なる"
"長さが 1 の文字列です::"
#: ../../tutorial/introduction.rst:253
msgid ""
"Indices may also be negative numbers, to start counting from the right::"
msgstr "インデクスは負の数を指定しても良く、そのときは右から数えていきます::"
#: ../../tutorial/introduction.rst:262
msgid "Note that since -0 is the same as 0, negative indices start from -1."
msgstr ""
"-0 は 0 と等しいので、負のインデクスは -1 から始まることに注意してください。"
#: ../../tutorial/introduction.rst:264
msgid ""
"In addition to indexing, *slicing* is also supported. While indexing is "
"used to obtain individual characters, *slicing* allows you to obtain a "
"substring::"
msgstr ""
"インデクス表記に加え、 *スライス* もサポートされています。インデクス表記は"
"個々の文字を取得するのに使いますが、 *スライス* を使うと部分文字列を取得する"
"ことができます::"
#: ../../tutorial/introduction.rst:272
msgid ""
"Note how the start is always included, and the end always excluded. This "
"makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::"
msgstr ""
"開始インデクスは常に含まれ、終了インデクスは常に含まれないことに注意してくだ"
"さい。なので ``s[:i] + s[i:]`` が常に ``s`` と等しい、ということになります::"
#: ../../tutorial/introduction.rst:280
msgid ""
"Slice indices have useful defaults; an omitted first index defaults to zero, "
"an omitted second index defaults to the size of the string being sliced. ::"
msgstr ""
"スライスのインデクスには便利なデフォルト値があります; 最初のインデクスを省略"
"すると、0 と見なされます。第 2 のインデクスを省略すると、スライスしようとする"
"文字列のサイズとみなされます。 ::"
#: ../../tutorial/introduction.rst:290
msgid ""
"One way to remember how slices work is to think of the indices as pointing "
"*between* characters, with the left edge of the first character numbered 0. "
"Then the right edge of the last character of a string of *n* characters has "
"index *n*, for example::"
msgstr ""
"スライスの働きかたをおぼえる良い方法は、インデクスが文字と文字の *あいだ "
"(between)* を指しており、最初の文字の左端が 0 になっていると考えることです。"
"そうすると、 *n* 文字からなる文字列中の最後の文字の右端はインデクス *n* とな"
"ります。例えばこうです::"
#: ../../tutorial/introduction.rst:301
msgid ""
"The first row of numbers gives the position of the indices 0...6 in the "
"string; the second row gives the corresponding negative indices. The slice "
"from *i* to *j* consists of all characters between the edges labeled *i* and "
"*j*, respectively."
msgstr ""
"1行目の数字は文字列の 0 から 6 までのインデクスの位置を示しています; 2行目は"
"対応する負のインデクスを示しています。*i* から *j* までのスライスは、それぞ"
"れ *i* と付いた境界から *j* と付いた境界までの全ての文字から成っています。"
#: ../../tutorial/introduction.rst:306
msgid ""
"For non-negative indices, the length of a slice is the difference of the "
"indices, if both are within bounds. For example, the length of "
"``word[1:3]`` is 2."
msgstr ""
"非負のインデクス対の場合、スライスされたシーケンスの長さは、スライスの両端の"
"インデクスが範囲内にあるかぎり、インデクス間の差になります。例えば、 "
"``word[1:3]`` の長さは 2 になります。"
#: ../../tutorial/introduction.rst:310
msgid "Attempting to use an index that is too large will result in an error::"
msgstr "大き過ぎるインデクスを使おうとするとエラーが発生します::"
#: ../../tutorial/introduction.rst:317
msgid ""
"However, out of range slice indexes are handled gracefully when used for "
"slicing::"
msgstr ""
"しかし、スライスで範囲外のインデクスを使ったときは上手く対応して扱ってくれま"
"す::"
#: ../../tutorial/introduction.rst:325
msgid ""
"Python strings cannot be changed --- they are :term:`immutable`. Therefore, "
"assigning to an indexed position in the string results in an error::"
msgstr ""
"Python の文字列は変更できません -- つまり不変 (:term:`immutable`) なのです。"
"従って、文字列のインデクスで指定したある場所に代入を行うとエラーが発生しま"
"す::"
#: ../../tutorial/introduction.rst:335
msgid "If you need a different string, you should create a new one::"
msgstr "元の文字列と別の文字列が必要な場合は、新しく文字列を作成してください::"
#: ../../tutorial/introduction.rst:342
msgid "The built-in function :func:`len` returns the length of a string::"
msgstr "組込み関数 :func:`len` は文字列の長さ (length) を返します::"
#: ../../tutorial/introduction.rst:354
msgid ":ref:`typesseq`"
msgstr ":ref:`typesseq`"
#: ../../tutorial/introduction.rst:352
msgid ""
"Strings, and the Unicode strings described in the next section, are examples "
"of *sequence types*, and support the common operations supported by such "
"types."
msgstr ""
"次節で記述されている文字列および Unicode 文字列は *シーケンス型* の例であり、"
"シーケンス型でサポートされている共通の操作をサポートしています。"
#: ../../tutorial/introduction.rst:358
msgid ":ref:`string-methods`"
msgstr ":ref:`string-methods`"
#: ../../tutorial/introduction.rst:357
msgid ""
"Both strings and Unicode strings support a large number of methods for basic "
"transformations and searching."
msgstr ""
"(バイト)文字列や Unicode 文字列では、基本的な変換や検索を行うための数多くのメ"
"ソッドをサポートしています。"
#: ../../tutorial/introduction.rst:361
msgid ":ref:`formatstrings`"
msgstr ":ref:`formatstrings`"
#: ../../tutorial/introduction.rst:361
msgid "Information about string formatting with :meth:`str.format`."
msgstr ""
":meth:`str.format` を使った文字列のフォーマットについての情報があります。"
#: ../../tutorial/introduction.rst:364
msgid ":ref:`string-formatting`"
msgstr ":ref:`string-formatting`"
#: ../../tutorial/introduction.rst:364
msgid ""
"The old formatting operations invoked when strings and Unicode strings are "
"the left operand of the ``%`` operator are described in more detail here."
msgstr ""
"(バイト)文字列や Unicode 文字列が ``%`` 演算子の左オペランドである場合に呼び"
"出される(古い)フォーマット操作については、ここで詳しく記述されています。"
#: ../../tutorial/introduction.rst:371
msgid "Unicode Strings"
msgstr "Unicode 文字列"
#: ../../tutorial/introduction.rst:376
msgid ""
"Starting with Python 2.0 a new data type for storing text data is available "
"to the programmer: the Unicode object. It can be used to store and "
"manipulate Unicode data (see http://www.unicode.org/) and integrates well "
"with the existing string objects, providing auto-conversions where necessary."
msgstr ""
"Python 2.0 から、プログラマはテキスト・データを格納するための新しいデータ"
"型、 Unicode オブジェクトを利用できるようになりました。 Unicode オブジェクト"
"を使うと、Unicode データ (http://www.unicode.org/ 参照) を記憶したり、操作し"
"たりできます。また、 Unicode オブジェクトは既存の文字列オブジェクトとよく統合"
"されていて、必要に応じて自動変換されます。"
#: ../../tutorial/introduction.rst:381
msgid ""
"Unicode has the advantage of providing one ordinal for every character in "
"every script used in modern and ancient texts. Previously, there were only "
"256 possible ordinals for script characters. Texts were typically bound to a "
"code page which mapped the ordinals to script characters. This lead to very "
"much confusion especially with respect to internationalization (usually "
"written as ``i18n`` --- ``'i'`` + 18 characters + ``'n'``) of software. "
"Unicode solves these problems by defining one code page for all scripts."
msgstr ""
"Unicode には、古今のテキストで使われているあらゆる書き文字のあらゆる文字につ"
"いて、対応付けを行うための一つの序数を規定しているという利点があります。これ"
"までは、書き文字のために利用可能な序数は 256 個しかなく、テキストは書き文字の"
"対応付けを行っているコードページに束縛されているのが通常でした。このことは、"
"とりわけソフトウェアの国際化 (internationalization. よく、 ``i18n`` と書かれ"
"ます --- ``'i'`` + 18 文字 + ``'n'`` の意) に対して大きな混乱をもたらしまし"
"た。Unicode では、すべての書き文字に対して単一のコードページを定義すること"
"で、これらの問題を解決しています。"
#: ../../tutorial/introduction.rst:389
msgid ""
"Creating Unicode strings in Python is just as simple as creating normal "
"strings::"
msgstr ""
"Python では、Unicode 文字列の作成は通常の文字列を作成するのと同じように単純な"
"ものです。"
#: ../../tutorial/introduction.rst:395
msgid ""
"The small ``'u'`` in front of the quote indicates that a Unicode string is "
"supposed to be created. If you want to include special characters in the "
"string, you can do so by using the Python *Unicode-Escape* encoding. The "
"following example shows how::"
msgstr ""
"クオートの前にある小文字の ``'u'`` は、Unicode 文字列を生成することになってい"
"ることを示します。文字列に特殊な文字を含めたければ、Python の *Unicode-"
"Escape* エンコーディングを使って行えます。以下はその方法を示しています。"
#: ../../tutorial/introduction.rst:403
msgid ""
"The escape sequence ``\\u0020`` indicates to insert the Unicode character "
"with the ordinal value 0x0020 (the space character) at the given position."
msgstr ""
"エスケープシーケンス ``\\u0020`` は、序数の値 0x0020 を持つ Unicode 文字 (ス"
"ペース文字) を、指定場所に挿入することを示します。"
#: ../../tutorial/introduction.rst:406
msgid ""
"Other characters are interpreted by using their respective ordinal values "
"directly as Unicode ordinals. If you have literal strings in the standard "
"Latin-1 encoding that is used in many Western countries, you will find it "
"convenient that the lower 256 characters of Unicode are the same as the 256 "
"characters of Latin-1."
msgstr ""
"他の文字は、それぞれの序数値をそのまま Unicode の序数値に用いて解釈されます。"
"多くの西洋諸国で使われている標準 Latin-1 エンコーディングのリテラル文字列があ"
"れば、Unicode の下位 256 文字が Latin-1 の 256 文字と同じになっていて便利だと"
"思うことでしょう。"
#: ../../tutorial/introduction.rst:412
msgid ""
"For experts, there is also a raw mode just like the one for normal strings. "
"You have to prefix the opening quote with 'ur' to have Python use the *Raw-"
"Unicode-Escape* encoding. It will only apply the above ``\\uXXXX`` "
"conversion if there is an uneven number of backslashes in front of the small "
"'u'. ::"
msgstr ""
"上級者のために、通常の文字列の場合と同じく raw モードもあります。これには、文"
"字列を開始するクオート文字の前に 'ur' を付けて、 Python に *Raw-Unicode-"
"Escape* エンコーディングを使わせなければなりません。このモードでは、上記の "
"``\\uXXXX`` の変換は、小文字の 'u' の前に奇数個のバックスラッシュがあるときに"
"だけ適用されます。"
#: ../../tutorial/introduction.rst:423
msgid ""
"The raw mode is most useful when you have to enter lots of backslashes, as "
"can be necessary in regular expressions."
msgstr ""
"raw モードは、正規表現を記述する時のように、沢山のバックスラッシュを入力しな"
"ければならないときとても役に立ちます。"
#: ../../tutorial/introduction.rst:426
msgid ""
"Apart from these standard encodings, Python provides a whole set of other "
"ways of creating Unicode strings on the basis of a known encoding."
msgstr ""
"これら標準のエンコーディングにとは別に、Python では、既知の文字エンコーディン"
"グに基づいて Unicode 文字列を生成する一連の手段を提供しています。"
#: ../../tutorial/introduction.rst:431
msgid ""
"The built-in function :func:`unicode` provides access to all registered "
"Unicode codecs (COders and DECoders). Some of the more well known encodings "
"which these codecs can convert are *Latin-1*, *ASCII*, *UTF-8*, and "
"*UTF-16*. The latter two are variable-length encodings that store each "
"Unicode character in one or more bytes. The default encoding is normally set "
"to ASCII, which passes through characters in the range 0 to 127 and rejects "
"any other characters with an error. When a Unicode string is printed, "
"written to a file, or converted with :func:`str`, conversion takes place "
"using this default encoding. ::"
msgstr ""
"組込み関数 :func:`unicode` は、登録されているすべての Unicode codecs (COder: "
"エンコーダと DECoder デコーダ) へのアクセス機能を提供します。codecs が変換で"
"きるエンコーディングには、よく知られているものとして *Latin-1*, *ASCII*, "
"*UTF-8* および *UTF-16* があります。後者の二つは可変長のエンコードで、各 "
"Unicode 文字を 1 バイトまたはそれ以上のバイト列に保存します。デフォルトのエン"
"コーディングは通常 ASCIIに設定されています。ASCIIでは 0 から 127 の範囲の文字"
"だけを通過させ、それ以外の文字は受理せずエラーを出します。 Unicode 文字列を印"
"字したり、ファイルに書き出したり、 :func:`str` で変換すると、デフォルトのエン"
"コーディングを使った変換が行われます。(訳注: IDLE をはじめ、ほとんどの "
"Python 2 用のインタラクティブシェルは、非ASCII 文字を含む Unicode リテラルを"
"利用することができません。このサンプルを実行するには、インタプリタ内蔵のイン"
"タラクティブシェルを利用する必要があります。この問題は Python 3 では解決され"
"ています。)"
#: ../../tutorial/introduction.rst:451
msgid ""
"To convert a Unicode string into an 8-bit string using a specific encoding, "
"Unicode objects provide an :func:`encode` method that takes one argument, "
"the name of the encoding. Lowercase names for encodings are preferred. ::"
msgstr ""
"特定のエンコーディングを使って Unicode 文字列を 8 ビットの文字列に変換するた"
"めに、Unicode オブジェクトは :func:`encode` メソッドを提供しています。このメ"
"ソッドは第一引数としてエンコーディングの名前をとります。エンコーディング名に"
"は小文字の使用が推奨されています。"
#: ../../tutorial/introduction.rst:458
msgid ""
"If you have data in a specific encoding and want to produce a corresponding "
"Unicode string from it, you can use the :func:`unicode` function with the "
"encoding name as the second argument. ::"
msgstr ""
"特定のエンコーディングで書かれているデータがあり、そこから Unicode 文字列を生"
"成したいなら、 :func:`unicode` を使い、第 2 引数にエンコーディング名を指定し"
"ます。"
#: ../../tutorial/introduction.rst:469
msgid "Lists"
msgstr "リスト"
#: ../../tutorial/introduction.rst:471
msgid ""
"Python knows a number of *compound* data types, used to group together other "
"values. The most versatile is the *list*, which can be written as a list of "
"comma-separated values (items) between square brackets. Lists might contain "
"items of different types, but usually the items all have the same type. ::"
msgstr ""
"Python 多くの *複合 (compound)* データ型を備えており、複数の値をまとめるのに"
"使われます。最も汎用性が高いのは *リスト (list)* で、コンマ区切りの値 (要素) "
"の並びを角括弧で囲んだものとして書き表されます。リストは異なる型の要素を含む"
"こともありますが、通常は全ての要素は同じ型を持ちます。 ::"
#: ../../tutorial/introduction.rst:480
msgid ""
"Like strings (and all other built-in :term:`sequence` type), lists can be "
"indexed and sliced::"
msgstr ""
"文字列 (や他の全てのビルトインのシーケンス (:term:`sequence`) 型) のように、"
"リストはインデクス表記やスライス表記ができます::"
#: ../../tutorial/introduction.rst:490
msgid ""
"All slice operations return a new list containing the requested elements. "
"This means that the following slice returns a new (shallow) copy of the "
"list::"
msgstr ""
"全てのスライス操作は指定された要素を含む新しいリストを返します。これは、次の"
"スライスはリストの新しい (浅い) コピーを返すことを意味します::"
#: ../../tutorial/introduction.rst:496
msgid "Lists also supports operations like concatenation::"
msgstr "リストは文字列の連結に似た操作もサポートしています::"
#: ../../tutorial/introduction.rst:501
msgid ""
"Unlike strings, which are :term:`immutable`, lists are a :term:`mutable` "
"type, i.e. it is possible to change their content::"
msgstr ""
"不変 (:term:`immutable`) な文字列とは違って、リストは可変 (:term:`mutable`) "
"型、つまり含んでいる要素を取り替えることができます::"
#: ../../tutorial/introduction.rst:511
msgid ""
"You can also add new items at the end of the list, by using the :meth:`~list."
"append` *method* (we will see more about methods later)::"
msgstr ""
":meth:`~list.append` を使って、リストの末尾に新しい要素を追加することもできま"
"す (このメソッドについては後で詳しく見ていきます)::"
#: ../../tutorial/introduction.rst:519
msgid ""
"Assignment to slices is also possible, and this can even change the size of "
"the list or clear it entirely::"
msgstr ""
"スライスに代入することもできます。スライスの代入を行って、リストのサイズを変"
"更したり、完全に消すことさえできます::"
#: ../../tutorial/introduction.rst:538
msgid "The built-in function :func:`len` also applies to lists::"
msgstr "組込み関数 :func:`len` はリストにも適用できます::"
#: ../../tutorial/introduction.rst:544
msgid ""
"It is possible to nest lists (create lists containing other lists), for "
"example::"
msgstr ""
"リストを入れ子にする (ほかのリストを含むリストを造る) ことも可能です。例え"
"ば::"
#: ../../tutorial/introduction.rst:560
msgid "First Steps Towards Programming"
msgstr "プログラミングへの第一歩"
#: ../../tutorial/introduction.rst:562
msgid ""
"Of course, we can use Python for more complicated tasks than adding two and "
"two together. For instance, we can write an initial sub-sequence of the "
"*Fibonacci* series as follows::"
msgstr ""
"もちろん、2 たす 2 よりももっと複雑な仕事にも Python を使うことができます。"
"*Fibonacci* 級数列の先頭の部分列は次のようにして書くことができます::"
#: ../../tutorial/introduction.rst:580
msgid "This example introduces several new features."
msgstr "上の例では、いくつか新しい機能を取り入れています。"
#: ../../tutorial/introduction.rst:582
msgid ""
"The first line contains a *multiple assignment*: the variables ``a`` and "
"``b`` simultaneously get the new values 0 and 1. On the last line this is "
"used again, demonstrating that the expressions on the right-hand side are "
"all evaluated first before any of the assignments take place. The right-"
"hand side expressions are evaluated from the left to the right."
msgstr ""
"最初の行には *複数同時の代入 (multiple assignment)* が入っています: 変数 "
"``a`` と ``b`` は、それぞれ同時に新しい値 0 と 1 になっています。この代入は最"
"後の行でも再度使われており、代入が行われる前に右辺の式がまず評価されます。右"
"辺の式は左から右へと順番に評価されます。"
#: ../../tutorial/introduction.rst:588
msgid ""
"The :keyword:`while` loop executes as long as the condition (here: ``b < "
"10``) remains true. In Python, like in C, any non-zero integer value is "
"true; zero is false. The condition may also be a string or list value, in "
"fact any sequence; anything with a non-zero length is true, empty sequences "
"are false. The test used in the example is a simple comparison. The "
"standard comparison operators are written the same as in C: ``<`` (less "
"than), ``>`` (greater than), ``==`` (equal to), ``<=`` (less than or equal "
"to), ``>=`` (greater than or equal to) and ``!=`` (not equal to)."
msgstr ""
":keyword:`while` は、条件 (ここでは ``b < 10``) が真である限り実行を繰り返し "
"(ループし) ます。Python では、C 言語と同様に、ゼロでない整数値は真となり、ゼ"
"ロは偽です。条件式は文字列値やリスト値、実際には任意のシーケンス型でもかまい"
"ません。 1つ以上の長さのシーケンスは真で、空のシーケンスは偽になります。例中"
"で使われている条件テストはシンプルな比較です。標準的な比較演算子は C 言語と同"
"様です: すなわち、 ``<`` (より小さい)、 ``>`` (より大きい)、 ``==`` (等し"
"い)、 ``<=`` (より小さいか等しい)、 ``>=`` (より大きいか等しい)、および ``!"
"=`` (等しくない)、です。"
#: ../../tutorial/introduction.rst:597
msgid ""
"The *body* of the loop is *indented*: indentation is Python's way of "
"grouping statements. At the interactive prompt, you have to type a tab or "
"space(s) for each indented line. In practice you will prepare more "
"complicated input for Python with a text editor; all decent text editors "
"have an auto-indent facility. When a compound statement is entered "
"interactively, it must be followed by a blank line to indicate completion "
"(since the parser cannot guess when you have typed the last line). Note "
"that each line within a basic block must be indented by the same amount."
msgstr ""
"ループの *本体 (body)* は *インデント (indent, 字下げ)* されています: インデ"
"ントは Python において実行文をグループにまとめる方法です。対話的プロンプトで"
"は、インデントされた各行を入力するにはタブや (複数個の) スペースを使わなけれ"
"ばなりません。実際には、Python へのより複雑な入力を準備するにはテキストエディ"
"タを使うことになるでしょう; ほとんどのテキストエディタは自動インデント機能を"
"持っています。複合文を対話的に入力するときには、(パーザはいつ最後の行を入力し"
"たのか推し量ることができないので) 入力の完了を示すために最後に空行を続けなけ"
"ればなりません。基本ブロックの各行は同じだけインデントされていなければならな"
"いので注意してください。"
#: ../../tutorial/introduction.rst:606
msgid ""
"The :keyword:`print` statement writes the value of the expression(s) it is "
"given. It differs from just writing the expression you want to write (as we "
"did earlier in the calculator examples) in the way it handles multiple "
"expressions and strings. Strings are printed without quotes, and a space is "
"inserted between items, so you can format things nicely, like this::"
msgstr ""
":keyword:`print` は指定した (1つまたは複数の) 式の値を書き出します。 :"
"keyword:`print` は、(電卓の例でしたように) 単に値を出力したい式を書くのとは、"
"複数の式や文字列を扱う方法が違います。文字列は引用符無しで出力され、複数の要"
"素の間にはスペースが挿入されるので、以下のように出力をうまく書式化できま"
"す。 ::"
#: ../../tutorial/introduction.rst:616
msgid "A trailing comma avoids the newline after the output::"
msgstr "末尾にコンマを入れると、出力を行った後に改行されません。"
#: ../../tutorial/introduction.rst:625
msgid ""
"Note that the interpreter inserts a newline before it prints the next prompt "
"if the last line was not completed."
msgstr ""
"インタプリタは、最後に入力した行がまだ完全な文になっていない場合、改行をはさ"
"んで次のプロンプトを出力することに注意してください。"
#: ../../tutorial/introduction.rst:629
msgid "Footnotes"
msgstr "注記"
#: ../../tutorial/introduction.rst:630
msgid ""
"Since ``**`` has higher precedence than ``-``, ``-3**2`` will be interpreted "
"as ``-(3**2)`` and thus result in ``-9``. To avoid this and get ``9``, you "
"can use ``(-3)**2``."
msgstr ""
"``**`` は ``-`` より優先順位が高いので、``-3**2`` は ``-(3**2)`` と解釈され、"
"計算結果は ``-9`` になります。これを避けて ``9`` を得たければ、``(-3)**2`` と"
"書けば良いです。"
#: ../../tutorial/introduction.rst:634
msgid ""
"Unlike other languages, special characters such as ``\\n`` have the same "
"meaning with both single (``'...'``) and double (``\"...\"``) quotes. The "
"only difference between the two is that within single quotes you don't need "
"to escape ``\"`` (but you have to escape ``\\'``) and vice versa."
msgstr ""
"他の言語と違って、``\\n`` のような特殊文字は単引用符 (``'...'``) と二重引用"
"符 (``\"...\"``) で同じ意味を持ちます。両者の唯一の違いは、単引用符で囲われた"
"箇所では ``\"`` をエスケープする必要がない (ただし ``\\'`` はエスケープする必"
"要がある) ことで、逆もまた同様です。"