tag:blogger.com,1999:blog-8699431508730375743.post6504592964632522567..comments2016-07-20T07:15:28.987-07:00Comments on The History of Python: Python's Design PhilosophyGuido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-8699431508730375743.post-24780924569956950972010-09-23T06:27:49.816-07:002010-09-23T06:27:49.816-07:00I've learned a lot from your website sir. It h...I've learned a lot from your website sir. It helps me doing my report regarding some backgrounds and history on python PL. As a matter of fact, we've been using python in creating simple programs. We are assigned as a group to do research on python, and as of now our end term requirement is to do a simple application using python. We decided to do a calendar that caters setting of reminders, with alarms. The problem is that, we don't know yet how to set reminders on the numbers of the calendar. We have to study more about it. If you have time to answer this sir, well it's our pleasure. :-) tnx!L_lizahttps://www.blogger.com/profile/06588844302445709143noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-70945292989913237452009-01-28T13:01:00.000-08:002009-01-28T13:01:00.000-08:00@oscar, in your raw string, what would happen if y...@oscar, in your raw string, what would happen if you wanted to have both a single and a double quote? without any means to escape the one which started the string. For me, this enough of a rationale.Unknownhttps://www.blogger.com/profile/03913919237788943977noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-55707966612244383652009-01-22T02:34:00.003-08:002009-01-22T02:34:00.003-08:00I think is the best!I think is the best!Cristian Grigorescuhttps://www.blogger.com/profile/01211295846795017463noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-54083527801596101312009-01-22T02:34:00.001-08:002009-01-22T02:34:00.001-08:00mine toomine tooCristian Grigorescuhttps://www.blogger.com/profile/01211295846795017463noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-25060199037035180672009-01-21T11:44:00.000-08:002009-01-21T11:44:00.000-08:00Spanish translation: here.Spanish translation: <A HREF="http://www.juanjoconti.com.ar/2009/01/21/la-historia-de-python-filosofia-de-diseno/" REL="nofollow">here</A>.Juanjo Contihttps://www.blogger.com/profile/00311238789779841975noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-6897187522444418922009-01-20T14:00:00.000-08:002009-01-20T14:00:00.000-08:00If you want to discuss colons, please do it in pyt...If you want to discuss colons, please do it in python-ideas@python.org.Guido van Rossumhttps://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-11365762504688718982009-01-20T10:02:00.001-08:002009-01-20T10:02:00.001-08:00i must say that this is really, really cool. pleas...i must say that this is really, really cool. please, tell me more!Emanuelhttps://www.blogger.com/profile/00922072521259005109noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-8554069429340169832009-01-18T15:12:00.000-08:002009-01-18T15:12:00.000-08:00I feel the python principle is the principle of pl...I feel the python principle is the principle of playing. It is about making it easy for people/things to play with each other. With this goal, you have to do those things that make python python.<BR/>http://freestone.wordpress.com/2007/12/13/python-principle/<BR/><BR/>http://freestone.wordpress.com/2009/01/18/python-design-philosophy-and-the-principle-of-playing/<BR/><BR/>http://freestone.wordpress.com/2008/03/20/build-a-better-playground/Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-3167681553651323582009-01-16T06:57:00.000-08:002009-01-16T06:57:00.000-08:00Hi verte,I tried googling "remove colons python" b...Hi verte,<BR/><BR/>I tried googling "remove colons python" before I asked the original question, and got nothing in the first page. Since you pointed out that there were discussions about this, I tried again. It turned out that I should use "drop colons python" instead to reach the link on python-dev mailing list. So thanks for mentioning it! (otherwise I'll miss it again)<BR/><BR/>Here is the link in case other people are interested: http://mail.python.org/pipermail/python-list/2006-November/413127.html<BR/><BR/>However, after finishing the thread I am somehow disappointed -- I have the same feeling as the guy, Michael Hobbs, who originally proposed the question. To quote him<BR/><BR/>"To clarify my position, I'm not intentionally being contradictory. In fact, when I first posed my question, I asked if anyone had a good reason for why the redundancy should continue to exist. Expecting to get a nice grammatical counter-example, the only viable answer that anyone could come up with is the FAQ answer that it improves readability. Since then, I've been fighting my point that the colon really doesn't improve readability all that much.<BR/><BR/>In the end, I have to admit that I really couldn't give a flying frog if the colon is there or not. It's just a colon, after all. I *was* hoping that I could convince someone to honestly think about it and consider if the colon is really that noticeable. But so far, the only response that I've received is that there's that ABC study somewhere and that settles that."<BR/><BR/>So basically, the "extensive reading of real world code and controlled studies" seem to be vapor. I strongly doubt it, especially when the majority of programming languages do not suffer from lack of colons. <BR/><BR/><BR/><BR/>I agree with you that semicolons are visual noises. However, I think colons are noises too; they seem read naturally because we are so used to them that we ignore them automatically--it doesn't change the fact that they are noises. As I said in previous posts, little if any is improved due to the existence of colons; readability of code blocks is contributed primarily by newlines and indentation. <BR/><BR/>I also agree that it is unfair to decide the syntax of Python merely based on how beginners feel. However I've used Python for several years but still make the same mistake sometimes, which lead me to think this is a non-trivial issue. If doable, I think it would be appropriate to do a survey among intermediate or senior Python users to see how often they forget to type colons and the interpreter complains. <BR/><BR/>Even if senior guys feel colons are OK, there are some other people feel it awkward, particularly people switched from other languages because most other languages do not have colons. Python's No.1 competitor Ruby (I think) seems to be much cleaner on this aspect (though other parts of it appear to be a mess to me). If colons are optional, I think there might be one fewer reason to reject Python if they are to choose. Remember Python tries to be an easy language for beginners. <BR/><BR/>Given that colons add little to readability, that they are easy to forget, that they require more keystrokes, and that they interrupt mental process, I think it is pretty harmless to make colons optional. Well, what could we possibly lose? If you like them you can continue use them, but if you don't like them, it should be possible to avoid them.Riobardhttps://www.blogger.com/profile/07798193240019177574noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-83430078785098688452009-01-16T03:35:00.000-08:002009-01-16T03:35:00.000-08:00@Riobard:There have been discussions on the dev li...@Riobard:<BR/><BR/>There have been discussions on the dev list about removing the colon that you might like to read. If you want to use semicolons, there is nothing preventing you, except that the community considers them to be visual noise. However, the colon fits in with its usage in English and reads very naturally. It's hard to draw from code written in a beginners class which is more readable- it comes from extensive reading of real world code, and controlled studies.wlesliehttps://www.blogger.com/profile/12093160811053013157noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-59677062333723809912009-01-16T03:19:00.000-08:002009-01-16T03:19:00.000-08:00spelling mistake: "As we will seen in later sectio...spelling mistake: "As we will seen in later sections".<BR/><BR/>nice reading!datgamehttps://www.blogger.com/profile/01223684777860896451noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-31656843779746690182009-01-15T04:58:00.000-08:002009-01-15T04:58:00.000-08:00Thanks Guido, i love reading the history of my fav...Thanks Guido, i love reading the history of my favourite programming language.bisiohttps://www.blogger.com/profile/07338721847810748278noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-28091961070526002592009-01-14T16:06:00.000-08:002009-01-14T16:06:00.000-08:00Hi Anand,I think you missed my point in the previo...Hi Anand,<BR/><BR/>I think you missed my point in the previous post. The sole purpose of newlines and indentation is to make code explicit, which they do a fantastic job. <BR/><BR/>But do we need colons to make code block even more explicit? I doubt it. The same reasoning, if it holds, applies very well to semicolons, in the sense that semicolons make statements explicit (and better than implicit). <BR/><BR/>So in short, such "visual cue" is already there by starting a newline and indenting to indicate the dependent code block. Extra colons seem to be redundant. They should go just as semicolons should go -- they stand in the way programmers think, interrupting the mental flow, and easy to forget (which leads to the common error I found for 2nd year CS students new to Python). <BR/><BR/>Well, unless Guido has something else in his mind ...Riobardhttps://www.blogger.com/profile/07798193240019177574noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-66454813140665369032009-01-14T06:32:00.000-08:002009-01-14T06:32:00.000-08:00"But just as semicolons are unnecessary if you wri..."But just as semicolons are unnecessary if you write multiple statements in separate lines, so should be colons."<BR/><BR/>I agree with Riobard. Colons tend to disrupt my coding process.<BR/><BR/>Another thing that bothers me is the behavior of raw strings:<BR/><BR/>Quoting from the Python Reference Manual:<BR/><BR/>----<BR/>Unless an "r" or "R" prefix is present, escape sequences in strings are interpreted according to rules similar to those used by Standard C.<BR/>----<BR/><BR/>So I understand that no matter what I include in a string, it will not be escaped. But later on it reads:<BR/><BR/>----<BR/>r"\" is not a valid string literal (even a raw string cannot end in an odd number of backslashes). Specifically, a raw string cannot end in a single backslash (since the backslash would escape the following quote character).<BR/>----<BR/><BR/>Uhm? Why would the bachslash escape the following quote character? Isn't this supposed to be "raw" string?<BR/><BR/>I would be glad to read the rationale behind this behavior.<BR/><BR/>Thanks for your work Guido!Oscarhttps://www.blogger.com/profile/01174112612087285262noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-71537410951259458712009-01-14T02:36:00.000-08:002009-01-14T02:36:00.000-08:00Hi Riobard, I think the Zen of Python ca...Hi Riobard,<BR/> <BR/> I think the Zen of Python can help you here.<BR/>It says "Explicit is better than Implicit". If you omit the colon, the start of the next block of code is implicit, but it is explicit if you have the colon. <BR/><BR/> I also find the colon giving a clear visual cue when I read the code that this means start of a dependent block of code in the next line - "Readability counts". The colon provides a clear visual clue to the mental "stop and continue from here for the next dependent block" idea it is used for.<BR/><BR/>Just my 2 cents.Anandhttps://www.blogger.com/profile/18362312542208032325noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-21203814195534505722009-01-13T19:47:00.000-08:002009-01-13T19:47:00.000-08:00Hi rhamphoryncus,I initially thought the same as y...Hi rhamphoryncus,<BR/><BR/>I initially thought the same as you. But later I found this common error of missing colons especially after if's and else's, which led me to think otherwise. <BR/><BR/>If the "visual cue" is true, then semicolon should also live, because it is indeed a visual cue, too. Considering newline and indentation, all if's and else's stand out themselves even better than most other statement needing a semicolon. <BR/><BR/>Also note most other programming languages do not have such "visual cue" after all. Java and C-based languages do not have the concept. Ruby's "then" seems optional. Heck even Perl (the punctuation language? :P ) does not have it! So I take it that most programmers are used to the situation without such "visual cues". <BR/><BR/>Thus the "visual cue" idea must be false. <BR/><BR/>Meanwhile, I think it is actually mind-taxing to enforce the colon requirement, esp. after if's. I found this one day when I was trying to describe a particular Python script I wrote before. It's like saying "if some condition is true [COLON], do this and this ...". Note how one have to mentally insert the COLON in the process. When you are actually writing the code, it takes a physical (SHIFT-;) as well as a mental break after finishing the CONDITION part to continue with the indented block. I guess newbies to Python must skip that two breaks so mistakes occur. <BR/><BR/>I guess Guido must have something different in mind ...Riobardhttps://www.blogger.com/profile/07798193240019177574noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-12644759948608210262009-01-13T19:06:00.000-08:002009-01-13T19:06:00.000-08:00Hopefully Guido will correct me if I'm wrong on th...Hopefully Guido will correct me if I'm wrong on this. ;)<BR/><BR/>The idea is that a colon serves as a visual cue. Although the statements are unambiguous to the parser, the human brain might take significantly longer to decipher the "simpler" form.<BR/><BR/>That's just Guido's instinctual opinion though. Proving or disproving it would require proper studies, measuring the response time of human subjects, as well as maybe using MRI to monitor effort of the brain.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-41296122867353265262009-01-13T17:38:00.000-08:002009-01-13T17:38:00.000-08:00Hi Guido, I'm not sure if this is a good place to ...Hi Guido, <BR/><BR/>I'm not sure if this is a good place to ask questions about the design of Python, but since you are reviewing its history of design, I guess I'd better have a try. The question was originally posted on Google Moderator - Ask a Google engineer. <BR/><BR/>You mentioned the "readability rule specifically: punctuation characters should be used conservatively". Then why do we still need colons (:) after if's, def's and for's when we have newlines and indentation to indicate the code block?<BR/><BR/>I asked the question while I was marking programming assignments for an introductory Python course. I noticed a common error of missing colons after if's and else's. <BR/><BR/>IMHO, colons are very similar to semicolons in the way that both can be used if one want to compact several lines into one, like:<BR/><BR/>if CONDITION: STATEMENT 1; STATEMENT 2; ... <BR/><BR/>But just as semicolons are unnecessary if you write multiple statements in separate lines, so should be colons. For example, the above one-liner can be re-written as<BR/><BR/>if CONDITION<BR/> STATEMENT 1<BR/> STATEMENT 2<BR/><BR/>I think this satisfies your readability rule. However, currently a colon is required even though the if statement stands in its own line, which I think causes problems for many newbies to Python, as most other programming languages do not require colons to end if's and else's. (Confession: I consider myself a senior Python user, but I sometimes make the same mistake, too). <BR/><BR/>I'd like to hear your opinion about this. Thank you very much!Riobardhttps://www.blogger.com/profile/07798193240019177574noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-60554507929347599302009-01-13T12:20:00.000-08:002009-01-13T12:20:00.000-08:00I remember taking a look at ABC during its brief h...I remember taking a look at ABC during its brief history and being somewhat confused as its concepts were unlike the Fortran I had used earlier. When I later discovered Python, I found it more to my liking. But I didn't know then how big it would become! It's still my favourite programming language.Stewart Midwinterhttps://www.blogger.com/profile/11149643002147748663noreply@blogger.com