Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 6th, 2004, 04:18 PM
ultimai ultimai is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 ultimai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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)

Reply With Quote
  #2  
Old March 6th, 2004, 04:32 PM
caroundw5h caroundw5h is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 185 caroundw5h User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 44 m 48 sec
Reputation Power: 0
Quote:
Originally Posted by ultimai
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)



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
I hope that answers your question. let me know.
__________________
"In theory, there is no difference between theory and practice.
But, in practice, there is."


Reply With Quote
  #3  
Old March 6th, 2004, 06:50 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #4  
Old March 6th, 2004, 07:00 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,585 DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 2 h 58 m 23 sec
Reputation Power: 1372
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.

Reply With Quote
  #5  
Old March 6th, 2004, 07:29 PM
XxChris XxChris is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 217 XxChris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I would say it is for, like DevCoach said, consistency.

Reply With Quote
  #6  
Old March 7th, 2004, 12:11 AM
ultimai ultimai is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 ultimai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #7  
Old March 7th, 2004, 05:22 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #8  
Old March 7th, 2004, 08:58 AM
XxChris XxChris is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 217 XxChris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by ultimai
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.


I was thinking the same thing when I started to used the Queue module. It starts with a capital, which it unusual.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Case sensitivity ads/disads?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap