← Back to team overview

launchpad-dev team mailing list archive

Re: New coding standard for formatting imports

 

Am 19.08.2010 16:09, schrieb Benji York:
> I prefer case-sensitive sorting because I'm lazy and case-sensitive
> sorting is the way my editor (and the GNU sort command) sort by default.

I was going to contradict you because my sort does not but then I realized
that it's my German locale's doing ... ;-) GNU sort's order is identical to
what sorted does in Python so that would speak for going the case-sensitive way.

What I don't like about that is that it effectively creates two lists - one
for words starting with an upper case letter followed by the list for words
starting with lower case letters. With camel case (i.e. cString) it gets even
more confusing and it is not very easy to find the right place to put your new
import.

Most importantly, the most common case in our code are identifiers that start
with an upper case letter (interfaces, classes). Lower-case identifiers
(functions) are not as common, often just one identifier mixed with a few more
of the others. With case-sensitive sorting that makes it the odd man out,
being pushed to the end of the list where it is hard to find. For example:
from lp.the.module import (
    Abcdefg,
    BardFoo,
    Doodle,
    MumbleUp,
    come_together,
    )

I think that is where case-insensitive ordering makes the list much more
usable for human readers:
from lp.the.module import (
    Abcdefg,
    BardFoo,
    come_together,
    Doodle,
    MumbleUp,
    )

So, 'nuff said about that, I will implement lower-case ordering. ;-)

Cheers,
Henning



Follow ups

References