Case-sensitivity: why -- or why not? (was Re: Damnation!)

Martijn Faassen m.faassen at vet.uu.nl
Mon Jun 5 08:01:04 EDT 2000


William Tanksley <wtanksle at dolphin.openprojects.net> wrote:
> On 30 May 2000 10:59:24 GMT, Martijn Faassen wrote:
>>William Tanksley <wtanksle at dolphin.openprojects.net> wrote:
[snip]
>>> Your rhetorical questions answer themselves.  Why should a programmer
>>> enforce these things?  Because it's stupid to NOT enforce them.  So
>>> enforce them already!

>>That's nice to say, but you don't agree with that yourself if you think
>>Python's use of indentation is a good thing. It can help a lot if the
>>language makes it impossible to be inconsistent. Unless you think the
>>_only_ advantage of Python's indentation strategy is the lesser line 
>>count.

> This is a classical example of false dichotomy ;-).

It's not.

> I liked Python's
> indentation not because it enforced consistency, but rather because it
> makes code look good.  In fact, it could be argued that Python does _not_
> enforce consistency; the programmer is free to choose any indentation for
> each block, so long as each block can be parsed (which does require
> internal consistency).

"""
I liked Python's
case sensitivity not because it enforced consistency, but rather because it
makes code look good. In fact, it could be argued that Python does _not_
enforce consistency; the programmer is free to choose any case-spelling for
each variable name, as long as each variable name can be parsed.
"""

Consistency in style happens to one of the most important factors that
makes code look good (on the syntactic level). Your indentation looks
better in Python because Python complains loudly if you don't indent properly.
That's not the most important thing though; you can indent properly in
any language. It's just that everybody indents properly in Python, and
more or less in the same way.

> More recently I've come to realise that the reason Python indentation
> looks good is that Python, like most modern languages, is a
> tree-structured language, and so is best represented in two dimensions.
> Most modern languages, however, attempt to represent themselves in one
> dimension: an ASCII stream which ignores lines and whitespace.

Well, why shouldn't a programmer enforce such indentation in any
language? Indentation looks good in any language, not just Python, so
that's not really an argument for Python's indentation style.

Besides, if you ignore case you ignore that words in Python are spelled
consistently in case, which is *also* a property of lots of modern languages.
Sometimes not enforced, but still a desired property of the programmer.

> So I don't really care about languages enforcing consistency; if I need
> it, I'll enforce it myself.

A computer language would be worth less if it brought no consistency at
all. I want my language to enforce the amount of parameters I pass to
a function, unless I overrule it myself. I want my language to consistently
enforce namespaces. I want my language to language to be consistent in
the way I can call functions (foo(1, 2) and not also foo 1, 2). I want
my language to be consistent in the way I spell keywords (I don't
want to see code with IF and ELIF all over the place while other modules
use 'if' and 'elif'). I want the language to be consistent about rejecting
things that make no direct sense ( 1 + "foo"..see also the discussion on
1/2).

According to your argument, you will just enforce this consistency
yourself. The problem is that, *even* if everybody enforces self
consistency, people will enforce *different* consistency and their
coding style will vary over time. From a maintenance and communication
point of view, this is bad. 

Any consistency that *can* be enforced by the language *should* be enforced
by the language, with the following caveats:

  * I explicitly overrule something

  * the enforcement of consistency makes the language significantly *less*
    readable/writable.

> Take a lesson from the people complaining
> about Python's indentation: one of the leading false accusations is that
> it's inflexible, that it won't allow people to choose thier own
> indentation.

I don't see how this maps to the case sensitivity argument at all. 
Python's indentation *is* less flexible in what code-layouts are
allowed, and it *is* a silly accusation. So I don't see why I should
take a lesson from this complaint or those people. Besides, people who make
this silly accusastion generally use languages which *are* case
sensitive. So I don't see how this relates to anything.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list