インデントについて
□未翻訳
□翻訳中
□翻訳完了(細田謙二)
■レビュー(Omi Chiba)
インデントについて
インデントについて
Pythonはインデントをコードブロックの区切りに利用しています。ブロック1つはコロンで終了する行から始まって、同じかそれより高いインデントが次の行として現れるまで続きます。例:
Python uses indentation to delimit blocks of code. A block starts with a line ending in colon, and continues for all lines that have a similar or higher indentation as the next line. For example:
1.
2.
3.
4.
5.
6.
7.
8.
>>> i = 0
>>> while i < 3:
>>> print i
>>> i = i + 1
>>>
0
1
2
各インデントのレベルには4つのスペースを使うのが一般的です。 (不可視の)混乱を招かないように、スペースとタブを混在しないことが得策です。
It is common to use four spaces for each level of indentation. It is a good policy not to mix tabs with spaces, which can result in (invisible) confusion.