1 |
On Sun, Dec 7, 2008 at 9:50 AM, Zac Medico <zmedico@g.o> wrote: |
2 |
> -----BEGIN PGP SIGNED MESSAGE----- |
3 |
> Hash: SHA1 |
4 |
> |
5 |
> Michael A. Smith wrote: |
6 |
>> Actually I don't like spaces for indentation at all. A tab character and a |
7 |
>> space character take the same number of bytes, so it takes two-to-eight |
8 |
>> times |
9 |
>> as much space per indentation to store the same indentation as a single tab |
10 |
>> character. On the average project that can add up to several kilobytes of |
11 |
>> difference. Furthermore, it completely _prevents_ collaborators from |
12 |
>> enjoying a |
13 |
>> bit of customization as to the amount of indentation. If I like my |
14 |
>> indentation |
15 |
>> to be two spaces, and you like yours to be four, then we can each set |
16 |
>> our text |
17 |
>> editors that way and continue to happily share code that uses tabs for |
18 |
>> indentation. |
19 |
>> |
20 |
>> I disagree with both PEP8 and Gentoo SOC styles on the matter. I would |
21 |
>> love it |
22 |
>> if someone could explain to me the actual benefit of using spaces over |
23 |
>> tabs. |
24 |
> |
25 |
> FWIW, I feel the same way. |
26 |
> |
27 |
> - -- |
28 |
> Thanks, |
29 |
> Zac |
30 |
> -----BEGIN PGP SIGNATURE----- |
31 |
> Version: GnuPG v2.0.9 (GNU/Linux) |
32 |
> |
33 |
> iEYEARECAAYFAkk7HbgACgkQ/ejvha5XGaPBmwCfdGEMZR7iegoVmfzCicNP/omE |
34 |
> WV8AoORjzg8IHtbAzVvEs1QJydiPXBKF |
35 |
> =VoL/ |
36 |
> -----END PGP SIGNATURE----- |
37 |
> |
38 |
> |
39 |
|
40 |
Again, not starting a holy war here, I'm happy using tabs as that's |
41 |
what people want, but you asked why most Python people prefer spaces, |
42 |
and one of the reasons is that it's considered Pythonic to match the |
43 |
indentation level of an opening parenthesis, for example: |
44 |
|
45 |
http://rafb.net/p/SHb5sC97.html |
46 |
|
47 |
With tabs you can't do that faithfully. And yes tabs do use less |
48 |
space, but at the expense of readability. Stripping doc string out |
49 |
would also use less space. As PEP 20 says, readability counts. As |
50 |
Python is largely reliant on indentation for meaning in code, spaces |
51 |
work well in python where they're not necessary in, say, bash. That's |
52 |
just MHO. |
53 |
|
54 |
-Doug |