|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Case sensitivity ads/disads?
Why would you design a programming language with case sensitvity in it's general syntax? (such as x and X being two different varibles) How does it help? What are its advantages?
(I'm not trying to bash python, I am just curious why this is a reaccuring theme with many programming languages) |
|
#2
|
|||
|
|||
|
Quote:
I don't think it is intended to be a nuissance, it simply is there to conform to the ASCII character codes. Where 'x' is represented by the decimal value 120 and 'X' by the decimal value 88. As there are times when you want to use one or the other, it allows not only options in your coding style, but conforms to standards necessary for all computers to better communicate. keep in mind that python still recognises both characters too. a x is still an x regardless of its ascii representation. ex: Code:
ltr = raw_input("enter ltr:").lower()
enter ltr: G
ltr
g
__________________
"In theory, there is no difference between theory and practice. But, in practice, there is."
|
|
#3
|
||||
|
||||
|
Where i don't know the technical reason why - i've never really questioned it but - I actually find it pretty useful.
Mainly because it allows for multiple objects with the same name - each with a different case - but it also seems logical that they are different... then, maybe thats because of we're used to it that way!? Case is also useful for passing info about the object around i.e. Python naming conventions say that class names should be writen as 'className' so its easy to see when we're talking about a class or a function. [QUOTE]Its one of those things that you will never know the answer to ... and will proberly drive you insane if you try/QUOTE] Hope this helps, Mark. |
|
#4
|
|||
|
|||
|
caroundw5h, I think the original poster meant why are keywords, variable names, function names etc case sensitive.
I have used both languages that are not case sensitive (e.g. VB) and languages that are case sensitive (e.g. virtually everything else), and I think the main answer is that case sensitive languages are easier to read. Consider this: you are looking at a program and you find a call to a function called "doStuff", so you scan through the listing looking for other references to this function. In a case sensitive language you know exactly what you are looking for. However in a case insensitive language it could be written as DoStuff, Dostuff, dostuff, DOSTUFF, dOsTuFf etc. Your brain has to do a hell of a lot more work just to find one function. Multiply that by all the variable, class and function names in the source code and simply reading the listing become a major chore. When we read we pay more attention to the overall shape of the word than to the individual letters - this is why UPPER CASE IS HARDER TO READ than lower case and RAndOmLy MixEd-CaSE WOrDs aRe evEN HaRdeR. If you do not know what the shape of a word is going to be in advance then you are forced to read words letter by letter, which will reduce your reading speed. Regards, Dave - The Developers' Coach Last edited by DevCoach : March 6th, 2004 at 07:04 PM. |
|
#5
|
|||
|
|||
|
I would say it is for, like DevCoach said, consistency.
|
|
#6
|
|||
|
|||
|
I personally find it annoying beacuse when you use third party libaries and such, the style tends to be different with each library, or changes ocassionally which can break your code and make you have to run things like pylint and do search and replaces through it.
|
|
#7
|
||||
|
||||
|
Gotta agree with Ulti, and even in the stadard library i'm still waiting got Python to enforce its naming and or conventions.
But i haven no problem with case sensativity as a hole and anything i write follows Pythons style guide as much as possiable. http://www.python.org/doc/essays/styleguide.html Mark. |
|
#8
|
|||
|
|||
|
Quote:
I was thinking the same thing when I started to used the Queue module. It starts with a capital, which it unusual. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Case sensitivity ads/disads? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|