True, False, None

Douglas Alan nessus at mit.edu
Fri Dec 5 03:11:54 EST 2003


mis6 at pitt.edu (Michele Simionato) writes:

> I never understood why you advocate case insensitivity. I would
> expect case insensitivity to be a source of bugs: for instance,
> identifiers with similar names could be confused (es. myfunction
> vs. myFunction): one would expect them to be different (at least
> people coming from case insensitive languages) whereas they would be
> the same.

When you use a case-insensitive language, you do not typically use
StudlyCaps at all, so you wouldn't ever write "myFunction".  Instead,
you would write "my_function" or "my-function", depending on the
language.  Then you might use "MY-FUNCTION" for ephasis.  For
instance, you might write:

   (defun MY-FUNCTION (x)  
      (if (= x 0)
          1
       'else
          (* x (my-function (- x 1)))))


Here "MY-FUNCTION" in in upper case, just so it stands out more
easily, kind of like how editors now show your function names in red
where they are defined, only you could do this back in the day of
black and white screens.

> Also, now I can write 

> ONE=1

> and

> def one(): return 1

> and it is clear that the first name (ONE) refers to a constant 
> whereas the second name (one) refers to something which is not a
> constant.

Personally, I hate this style, because I can't stand to have
constants shouting at me in upper case all of the time.  Save the
shouting for when it's important, DAMNIT!

I prefer constants to be written as c_one, or something like that that
is less loud on my delicate ears^H^H^H^Heyes.

|>oug




More information about the Python-list mailing list