3 ms·
I'm not sure if you're trolling, but obviously not everyone would agree that this is the "proper way."
by michaelmior 11y ago
I'm not sure if you're trolling, but obviously not everyone would agree that this is the "proper way."
- benatkin 11y agoI'm not. The obvious way to fix it would be to add a token signifying indenting one level. Why not choose the tab character as the token?
- jheriko 11y ago... its almost as if it was entered into the character set for that precise purpose even. XD
- brownbat 11y agoObvious depends on your constraints. Suppose (1) some of your newlines are indented but some are aligned for readability, and (2) mixing whitespace has a tendency to create subtle bugs. Under those constraints, the only possible choice is spaces. Tabs can indent, but only spaces can either indent or align. Process of elimination forces you to prefer spaces over tabs in that situation. This might be why PEP 0008 urges, "Spaces are the preferred indentation method." https://www.python.org/dev/peps/pep-0008/ https://www.python.org/dev/peps/pep-0008/ [Specifically, four spaces.] I had heard Google urged two spaces for indentation of Python, per some old style guide, but not sure if that's still followed or not.
- arantius 11y agoGoogle's current Python style guide absolutely calls for two spaces. All of the languages I'm familiar with (at Google) do this. Except golang ...