FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Portage Developer

 
 
LinkBack Thread Tools
 
Old 12-06-2008, 11:50 PM
Zac Medico
 
Default Python style (Was: equery refactorization)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael A. Smith wrote:
> Actually I don't like spaces for indentation at all. A tab character and a
> space character take the same number of bytes, so it takes two-to-eight
> times
> as much space per indentation to store the same indentation as a single tab
> character. On the average project that can add up to several kilobytes of
> difference. Furthermore, it completely _prevents_ collaborators from
> enjoying a
> bit of customization as to the amount of indentation. If I like my
> indentation
> to be two spaces, and you like yours to be four, then we can each set
> our text
> editors that way and continue to happily share code that uses tabs for
> indentation.
>
> I disagree with both PEP8 and Gentoo SOC styles on the matter. I would
> love it
> if someone could explain to me the actual benefit of using spaces over
> tabs.

FWIW, I feel the same way.

- --
Thanks,
Zac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkk7HbgACgkQ/ejvha5XGaPBmwCfdGEMZR7iegoVmfzCicNP/omE
WV8AoORjzg8IHtbAzVvEs1QJydiPXBKF
=VoL/
-----END PGP SIGNATURE-----
 
Old 12-07-2008, 03:07 AM
"Douglas Anderson"
 
Default Python style (Was: equery refactorization)

On Sun, Dec 7, 2008 at 9:50 AM, Zac Medico <zmedico@gentoo.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Michael A. Smith wrote:
>> Actually I don't like spaces for indentation at all. A tab character and a
>> space character take the same number of bytes, so it takes two-to-eight
>> times
>> as much space per indentation to store the same indentation as a single tab
>> character. On the average project that can add up to several kilobytes of
>> difference. Furthermore, it completely _prevents_ collaborators from
>> enjoying a
>> bit of customization as to the amount of indentation. If I like my
>> indentation
>> to be two spaces, and you like yours to be four, then we can each set
>> our text
>> editors that way and continue to happily share code that uses tabs for
>> indentation.
>>
>> I disagree with both PEP8 and Gentoo SOC styles on the matter. I would
>> love it
>> if someone could explain to me the actual benefit of using spaces over
>> tabs.
>
> FWIW, I feel the same way.
>
> - --
> Thanks,
> Zac
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
>
> iEYEARECAAYFAkk7HbgACgkQ/ejvha5XGaPBmwCfdGEMZR7iegoVmfzCicNP/omE
> WV8AoORjzg8IHtbAzVvEs1QJydiPXBKF
> =VoL/
> -----END PGP SIGNATURE-----
>
>

Again, not starting a holy war here, I'm happy using tabs as that's
what people want, but you asked why most Python people prefer spaces,
and one of the reasons is that it's considered Pythonic to match the
indentation level of an opening parenthesis, for example:

http://rafb.net/p/SHb5sC97.html

With tabs you can't do that faithfully. And yes tabs do use less
space, but at the expense of readability. Stripping doc string out
would also use less space. As PEP 20 says, readability counts. As
Python is largely reliant on indentation for meaning in code, spaces
work well in python where they're not necessary in, say, bash. That's
just MHO.

-Doug
 
Old 12-07-2008, 05:10 PM
"Alec Warner"
 
Default Python style (Was: equery refactorization)

On Sat, Dec 6, 2008 at 3:21 PM, Michael A. Smith <michael@smith-li.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Actually I don't like spaces for indentation at all. A tab character and a
> space character take the same number of bytes, so it takes two-to-eight
> times
> as much space per indentation to store the same indentation as a single tab
> character. On the average project that can add up to several kilobytes of
> difference. Furthermore, it completely _prevents_ collaborators from
> enjoying a
> bit of customization as to the amount of indentation. If I like my
> indentation
> to be two spaces, and you like yours to be four, then we can each set our
> text
> editors that way and continue to happily share code that uses tabs for
> indentation.

I would imagine most projects are not size constrained in their
sources; also most sources are zipped and it turns out a series of
spaces compresses rather well, so I don't find this to be a compelling
advantage (I have plenty of disk space, disk bandwidth, and network
bandwidth). Perhaps when serving thousands of copies of a specific
tree this advantage will turn out to be useful in the long run (5k *
10000 req = 50meg savings.)

>
> I disagree with both PEP8 and Gentoo SOC styles on the matter. I would love
> it
> if someone could explain to me the actual benefit of using spaces over tabs.

My eyes hurt less

But seriously, aside from what Douglas stated (spaces are displayed at
a constant size, and are typically smaller (on the display) than tabs
(I've never seen anyone use = ' ', but I guess it is possible)
there are no real benefits, it is a preference.

I'm not going to argue with you about which one is better; I agree
that tabs are nice due to tabwidth, but I still prefer spaces.

I don't think anyone on this list is nazi enough about style to reject
code based on it...I mean..you have seen portage right? It is not the
pinnacle of style here

>
> I'll reply to the rest of the equery refactorization thread in a different
> email.
>
> - -Michael
>
> Douglas Anderson wrote:
> |> [1] http://code.google.com/p/soc/wiki/PythonStyleGuide
> |>
> |
> | I'm with you there, I really like that style guide as well. We should
> | adopt it
> |
> | -Doug
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkk7COYACgkQzwtr5yY0JZyGFwCcCAI1oRKkfK 0W1d5U5AQBQ4D8
> fooAoIQS8sH+KRdT8e9TgJ4nXOYXKgae
> =71ob
> -----END PGP SIGNATURE-----
>
>
 

Thread Tools




All times are GMT. The time now is 05:25 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org