Re: Teaching Programming
alex23 wrote: This is my biggest issue with Knuth's view of literate programming. If the generated source isn't readable, am I just supposed to trust it? How can I tell if an error lies in my expression of the algorithm or in the code generation itself? Knuth would say that the code generator should itself be a literate program, so that it's obviously correct. :-) -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
alex23 wrote: Ed Keith e_...@yahoo.com wrote: Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code. This is my biggest issue with Knuth's view of literate programming. If the generated source isn't readable, am I just supposed to trust it? How can I tell if an error lies in my expression of the algorithm or in the code generation itself? Do you think a compiler is required to make its object file conveniently readable? Do you regularly read the machine code generated by your C compiler? I admit I've frequently studied compiler output over the years, but I think I'm very unusual in that respect. I've never disassembled a python byte code file, though I wrote tools to display and manipulate both java byte code files and dot-net (before it was called that). I think the question really boils down to whether you trust the compiler. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, alex23 wuwe...@gmail.com wrote: From: alex23 wuwe...@gmail.com Subject: Re: Teaching Programming To: python-list@python.org Date: Tuesday, May 4, 2010, 8:47 PM Ed Keith e_...@yahoo.com wrote: Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code. This is my biggest issue with Knuth's view of literate programming. If the generated source isn't readable, am I just supposed to trust it? How can I tell if an error lies in my expression of the algorithm or in the code generation itself? -- http://mail.python.org/mailman/listinfo/python-list My feelings exactly. I can see an argument for an option to emit obstructed code, but the default should be readable. -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 5/5/2010 4:50 AM, Dave Angel wrote: alex23 wrote: Ed Keith e_...@yahoo.com wrote: Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code. This is my biggest issue with Knuth's view of literate programming. If the generated source isn't readable, am I just supposed to trust it? How can I tell if an error lies in my expression of the algorithm or in the code generation itself? Do you think a compiler is required to make its object file conveniently readable? Do you regularly read the machine code generated by your C compiler? I admit I've frequently studied compiler output over the years, but I think I'm very unusual in that respect. I've never disassembled a python byte code file, The output from dis.dis() is quite readable, and people (developers and others) have used it to check on what the compiler is doing. -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 05/04/10 12:59, superpollo wrote: Martin P. Hellwig ha scritto: cut For the corner cases (I can think of a couple) it is good to know you can use ';' most of the time. most but not always as i noted (think about loops or function definition) Well through in some exec magic then, for example: for number in [1,2,3,4]: def nprint(number): print(number) number += 1 nprint(number translates to: exec('for number in [1,2,3,4]:\n\tdef nprint(number):\n\t\tprint(number)\n\tnumber += 1\n\tnprint(number)') 2 3 4 5 But if you have an example why indentation is still a problem please give it :-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Martin P. Hellwig ha scritto: On 05/04/10 12:59, superpollo wrote: Martin P. Hellwig ha scritto: cut For the corner cases (I can think of a couple) it is good to know you can use ';' most of the time. most but not always as i noted (think about loops or function definition) Well through in some exec magic then, for example: for number in [1,2,3,4]: def nprint(number): print(number) number += 1 nprint(number translates to: exec('for number in [1,2,3,4]:\n\tdef nprint(number):\n\t\tprint(number)\n\tnumber += 1\n\tnprint(number)') 2 3 4 5 But if you have an example why indentation is still a problem please give it :-) i think your exec example solved most of my problems. thanks a lot. bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
André wrote: To Samuel Williams:(and other interested ;-) If you want to consider Python in education, I would encourage you have a look at http://www.python.org/community/sigs/current/edu-sig/ I think you will find that there are quite a few resources available - perhaps more than you are aware of. And, I don't think that because some people do not like the indentation strategy is a valid reason not to consider that Python's syntax is concise and simple. Actually, I would almost argue for the contrary. Indentation indicate programming structure/logic very clearly, without the need for arbitrary keywords and other punctuation symbols. There are very few keywords in the language. You indicate that Python programs are readable. They are also known to be short (much shorter than some other languages). André Python indentation has been already discussed many times around, I remember someone saying something like How is it possible not to like indentation while any decent programmer will use it no matter the language, including all those which feature statements/keywords for blocks. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
I personally like indentation. I just wonder whether it is an issue that some people will dislike. But anyway, I updated the language comparison to remove this critique. Kind regards, Samuel On 4/05/2010, at 9:22 PM, Jean-Michel Pichavant wrote: André wrote: To Samuel Williams:(and other interested ;-) If you want to consider Python in education, I would encourage you have a look at http://www.python.org/community/sigs/current/edu-sig/ I think you will find that there are quite a few resources available - perhaps more than you are aware of. And, I don't think that because some people do not like the indentation strategy is a valid reason not to consider that Python's syntax is concise and simple. Actually, I would almost argue for the contrary. Indentation indicate programming structure/logic very clearly, without the need for arbitrary keywords and other punctuation symbols. There are very few keywords in the language. You indicate that Python programs are readable. They are also known to be short (much shorter than some other languages). André Python indentation has been already discussed many times around, I remember someone saying something like How is it possible not to like indentation while any decent programmer will use it no matter the language, including all those which feature statements/keywords for blocks. JM -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. there might be problems if for example you generate code from a one-line template. i use a special template system for my job, which goes like this: ... %%SCHEMA:PYCODE1:print $A*2**($B) ... $A, $B, $C being loop control variables reserved to the template system. upon parsing, the system generates the corresponding code (say print 12*2**3) and stores the output for further use. due to design restrictions, i cannot write a code-template which spans multiple template-lines, and that is a problem with python, because for instance i cannot use conditionals or for loops. if it was C or java there wuold be no problem since the source is free-form, so an entire program can live on a single source line. bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo, 04.05.2010 12:28: i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. there might be problems if for example you generate code from a one-line template. There are a couple of code generation tools available that you can find on PyPI. However, the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't run into problems with it. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Stefan Behnel ha scritto: superpollo, 04.05.2010 12:28: i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. there might be problems if for example you generate code from a one-line template. There are a couple of code generation tools available that you can find on PyPI. However, the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't run into problems with it. Stefan Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. A,B=2,3 if AB: ... print A+B ... else: ... print A**B-B**2 ... -1 A,B=3,2 if AB: ... print A+B ... else: ... print A**B-B**2 ... 5 tell me please: how can generate the same output (depending on A and B) without control structure? i mean in a natural pythonic way... bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 05/04/10 11:28, superpollo wrote: Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. cut there might be problems if for example you generate code from a one-line template. cut Well a one-line template code generator are great and such, but if the output should be human readable it is necessary to have at least some form of mark-up control on it. Like newlines and indentations. On the other hand if it is only meant to generate executable code, generating an interpreted code might not be the best solution for the actual problem. For the corner cases (I can think of a couple) it is good to know you can use ';' most of the time. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo, 04.05.2010 13:23: Stefan Behnel ha scritto: the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't run into problems with it. Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. A,B=2,3 if AB: ... print A+B ... else: ... print A**B-B**2 ... -1 A,B=3,2 if AB: ... print A+B ... else: ... print A**B-B**2 ... 5 tell me please: how can generate the same output (depending on A and B) without control structure? i mean in a natural pythonic way... The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Stefan Behnel ha scritto: superpollo, 04.05.2010 13:23: Stefan Behnel ha scritto: the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't run into problems with it. Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. A,B=2,3 if AB: ... print A+B ... else: ... print A**B-B**2 ... -1 A,B=3,2 if AB: ... print A+B ... else: ... print A**B-B**2 ... 5 tell me please: how can generate the same output (depending on A and B) without control structure? i mean in a natural pythonic way... The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: def fun(): ecc... how can i put *that* on a oneliner? -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Martin P. Hellwig ha scritto: On 05/04/10 11:28, superpollo wrote: Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. cut there might be problems if for example you generate code from a one-line template. cut Well a one-line template code generator are great and such, but if the output should be human readable it is necessary to have at least some form of mark-up control on it. Like newlines and indentations. or latex markup, in my case... On the other hand if it is only meant to generate executable code, generating an interpreted code might not be the best solution for the actual problem. yes, maybe generating code for a *compiler* might be faster but you must consider overhead due to compilation time, especially if code snippets are sprinkled by the dozen all over the template file. For the corner cases (I can think of a couple) it is good to know you can use ';' most of the time. most but not always as i noted (think about loops or function definition) bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, May 4, 2010 at 9:43 PM, Stefan Behnel stefan...@behnel.de wrote: Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. A,B=2,3 if AB: ... print A+B ... else: ... print A**B-B**2 ... -1 A,B=3,2 if AB: ... print A+B ... else: ... print A**B-B**2 ... 5 tell me please: how can generate the same output (depending on A and B) without control structure? i mean in a natural pythonic way... def quadratic(a, b): ... return a + b if a b else a**b - b**2 ... a, b = 2, 3 print quadratic(a, b) -1 a, b = 3, 2 print quadratic(a, b) 5 --james -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, May 4, 2010 at 9:56 PM, superpollo ute...@esempio.net wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type help, copyright, credits or license for more information. a, b = 2, 3 print a + b if a b else a**b - b**2 -1 a, b = 3, 2 print a + b if a b else a**b - b**2 5 --James -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, Stefan Behnel stefan...@behnel.de wrote: From: Stefan Behnel stefan...@behnel.de Subject: Re: Teaching Programming To: python-list@python.org Date: Tuesday, May 4, 2010, 7:43 AM superpollo, 04.05.2010 13:23: Stefan Behnel ha scritto: the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't run into problems with it. Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. A,B=2,3 if AB: ... print A+B ... else: ... print A**B-B**2 ... -1 A,B=3,2 if AB: ... print A+B ... else: ... print A**B-B**2 ... 5 tell me please: how can generate the same output (depending on A and B) without control structure? i mean in a natural pythonic way... The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? Stefan -- http://mail.python.org/mailman/listinfo/python-list Just thought I'd add my $0.02 here. I wrote AsciiLitProg (http://asciilitprog.berlios.de/) in Python. It is a literate programming tool. It generates code from a document. It can generate code in any language the author wants. It would have been a LOT easier to write if it did not generate Python code. Python is a great language to write in (although I do wish it did a better job with closures). But it is a PITA to generate code for! -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, May 4, 2010 at 7:23 AM, superpollo ute...@esempio.net wrote: Stefan Behnel ha scritto: superpollo, 04.05.2010 12:28: i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. there might be problems if for example you generate code from a one-line template. There are a couple of code generation tools available that you can find on PyPI. However, the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so people don't run into problems with it. Stefan Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. A,B=2,3 if AB: ... print A+B ... else: ... print A**B-B**2 ... -1 A,B=3,2 if AB: ... print A+B ... else: ... print A**B-B**2 ... 5 tell me please: how can generate the same output (depending on A and B) without control structure? i mean in a natural pythonic way... bye Well, it requires 2.6 or 3 Python 2.6.5 (r265:79063, Mar 21 2010, 22:38:52) [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin Type help, copyright, credits or license for more information. from __future__ import print_function A,B=2,3;print(A+B if A B else A**B - B**2) -1 A,B=3,2;print(A+B if A B else A**B - B**2) 5 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo ute...@esempio.net wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type help, copyright, credits or license for more information. a, b = 2, 3 print a + b if a b else a**b - b**2 -1 a, b = 3, 2 print a + b if a b else a**b - b**2 5 --James much obliged. -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo, 04.05.2010 13:56: Stefan Behnel ha scritto: The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? of course! *but* if i must generate on-the-fly python code that defines a function [...] Well, could you provide a use case where you have to generate Python code, and where normally written code with some kind of parametrisation won't work? The only thing that currently comes to my mind is a template compiler that translates a user provided template into an executable Python program. But that should be pretty trivial to do as well. I just remembered this little thing on Fredrik's effbot site, which should help here: http://effbot.org/zone/python-code-generator.htm Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Ed Keith, 04.05.2010 14:15: I wrote AsciiLitProg (http://asciilitprog.berlios.de/) in Python. It is a literate programming tool. It generates code from a document. It can generate code in any language the author wants. It would have been a LOT easier to write if it did not generate Python code. Python is a great language to write in (although I do wish it did a better job with closures). But it is a PITA to generate code for! Interesting. Could you elaborate a bit? Could you give a short example of what kind of document text you translate into what kind of Python code, and what the problems were that you faced in doing so? Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Stefan Behnel ha scritto: superpollo, 04.05.2010 13:56: Stefan Behnel ha scritto: The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? of course! *but* if i must generate on-the-fly python code that defines a function [...] Well, could you provide a use case where you have to generate Python code, and where normally written code with some kind of parametrisation won't work? i see your point, and mr mills gave me hints as to how to attack some of my problems in such a fashion. The only thing that currently comes to my mind is a template compiler that translates a user provided template into an executable Python program. But that should be pretty trivial to do as well. I just remembered this little thing on Fredrik's effbot site, which should help here: http://effbot.org/zone/python-code-generator.htm very good. i will most certainly give it a try. but i do not think i can use it myself, since my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, Stefan Behnel stefan...@behnel.de wrote: From: Stefan Behnel stefan...@behnel.de Subject: Re: Teaching Programming To: python-list@python.org Date: Tuesday, May 4, 2010, 8:40 AM Ed Keith, 04.05.2010 14:15: I wrote AsciiLitProg (http://asciilitprog.berlios.de/) in Python. It is a literate programming tool. It generates code from a document. It can generate code in any language the author wants. It would have been a LOT easier to write if it did not generate Python code. Python is a great language to write in (although I do wish it did a better job with closures). But it is a PITA to generate code for! Interesting. Could you elaborate a bit? Could you give a short example of what kind of document text you translate into what kind of Python code, and what the problems were that you faced in doing so? Stefan -- http://mail.python.org/mailman/listinfo/python-list The program is written using itself. If you click on the link above you will see an HTML file that fully describes the program. That HTML is generated from an AcsiiDoc (http://www.methods.co.nz/asciidoc/) document. The same document is used to generate the python code that it describes. The source document, and the generated HTML and Python code are all avalable at BerliOS (http://developer.berlios.de/projects/asciilitprog/). For more information on Literate Programming in general see the following links. http://www.literateprogramming.com/ http://en.wikipedia.org/wiki/Literate_programming http://en.literateprograms.org/LiteratePrograms:Welcome -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Stefan Behnel ha scritto: superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? ok, since you asked for it, prepare yourself for a bit of a horror story ;-) i will answer in my next post bye -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Ed Keith e_...@yahoo.com wrote: For more information on Literate Programming in general see the following links. None of which address the question of what you found problematic about generating Python code. Was it issues with indentation? -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, alex23 wuwe...@gmail.com wrote: From: alex23 wuwe...@gmail.com Subject: Re: Teaching Programming To: python-list@python.org Date: Tuesday, May 4, 2010, 10:06 AM Ed Keith e_...@yahoo.com wrote: For more information on Literate Programming in general see the following links. None of which address the question of what you found problematic about generating Python code. Was it issues with indentation? -- http://mail.python.org/mailman/listinfo/python-list Yes, the problem was indentation. To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the indentation of the enclosing chunks. and 2) expand all tabls to spaces and allow the user to set the tab expansion size from the command line. Fortunately Python provides good support for this. Neither of these problems exist in languages that are not indention sensitive. Tabs are always a problem when writing Python. I get around this problem by setting my text editor to expand all tabs with spaces when editing Python, but I have had problems when coworkers have not done this. Don't get me wrong, I love working in Python. It is one of my favorite languages, but it, like all other languages, is not perfect. -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Wed, May 5, 2010 at 12:21 AM, Ed Keith e_...@yahoo.com wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the indentation of the enclosing chunks. In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. --James -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, May 4, 2010 at 4:35 PM, James Mills prolo...@shortcircuit.net.au wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith e_...@yahoo.com wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the indentation of the enclosing chunks. In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. Although I have little or no experience with this, I still dare to say that I don't agree. The difference is that in C you do not _need_ to know where in the braces-defined hierarchy you are. You just embed or change a piece of code at the right location. In Python however you _do_ need to know how far your code is to be indented. -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, James Mills prolo...@shortcircuit.net.au wrote: From: James Mills prolo...@shortcircuit.net.au Subject: Re: Teaching Programming To: python list python-list@python.org Date: Tuesday, May 4, 2010, 10:35 AM On Wed, May 5, 2010 at 12:21 AM, Ed Keith e_...@yahoo.com wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the indentation of the enclosing chunks. In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. --James -- http://mail.python.org/mailman/listinfo/python-list Not in this case, because the user is required to include all text of the program in the chunks, the tools does not generate any text, It only needs to generate white space if the language is white space sensitive. I can see how it could be a problem in other cases. In the interest of completeness, I should mention that I had to take care not to introduce extraneous line breaks for languages that are sensitive to them. It is much easier to generate code for languages that are completely white space agnostic. I actually find the fact that I need to think about where I can, and where I can not, break a line to be a bigger problem when write code, than keeping track of indentation level. And Python is not the only language that has this problem. -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, Andre Engels andreeng...@gmail.com wrote: From: Andre Engels andreeng...@gmail.com Subject: Re: Teaching Programming To: James Mills prolo...@shortcircuit.net.au Cc: python list python-list@python.org Date: Tuesday, May 4, 2010, 11:00 AM On Tue, May 4, 2010 at 4:35 PM, James Mills prolo...@shortcircuit.net.au wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith e_...@yahoo.com wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the indentation of the enclosing chunks. In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. Although I have little or no experience with this, I still dare to say that I don't agree. The difference is that in C you do not _need_ to know where in the braces-defined hierarchy you are. You just embed or change a piece of code at the right location. In Python however you _do_ need to know how far your code is to be indented. For a programmer, it is harder to keep track of braced. For a code generator, it is harder to keep track of indentation. It is a matter of which you are more interested in catering to. Python is easier to write, C is easier to generate. -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Andre Engels wrote: On Tue, May 4, 2010 at 4:35 PM, James Mills prolo...@shortcircuit.net.au wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith e_...@yahoo.com wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the indentation of the enclosing chunks. In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. Although I have little or no experience with this, I still dare to say that I don't agree. The difference is that in C you do not _need_ to know where in the braces-defined hierarchy you are. You just embed or change a piece of code at the right location. In Python however you _do_ need to know how far your code is to be indented. And how do you know where the right location is? You have to figure it out from the different (nested) braces at the 'right' location. For me, at least, it's much easier to get that information from the already indented Python code, as opposed to indenting (and double-checking the indents) on the braces language. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Ed Keith, 04.05.2010 15:19: --- On Tue, 5/4/10, Stefan Behnel wrote: Ed Keith, 04.05.2010 14:15: Python is a great language to write in (although I do wish it did a better job with closures). But it is a PITA to generate code for! Interesting. Could you elaborate a bit? Could you give a short example of what kind of document text you translate into what kind of Python code, and what the problems were that you faced in doing so? The program is written using itself. If you click on the link above you will see an HTML file that fully describes the program. I did. I find it a bit hard to read due to the block splitting (basically like 'include' based spaghetti programming), but so far, the actual code that does the code merging looks pretty simple and I can't figure out where the PITA bit is on that page. That's why I asked. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, Stefan Behnel stefan...@behnel.de wrote: From: Stefan Behnel stefan...@behnel.de Subject: Re: Teaching Programming To: python-list@python.org Date: Tuesday, May 4, 2010, 11:33 AM Ed Keith, 04.05.2010 15:19: --- On Tue, 5/4/10, Stefan Behnel wrote: Ed Keith, 04.05.2010 14:15: Python is a great language to write in (although I do wish it did a better job with closures). But it is a PITA to generate code for! Interesting. Could you elaborate a bit? Could you give a short example of what kind of document text you translate into what kind of Python code, and what the problems were that you faced in doing so? The program is written using itself. If you click on the link above you will see an HTML file that fully describes the program. I did. I find it a bit hard to read due to the block splitting (basically like 'include' based spaghetti programming), but so far, the actual code that does the code merging looks pretty simple and I can't figure out where the PITA bit is on that page. That's why I asked. Stefan -- http://mail.python.org/mailman/listinfo/python-list The PITA is having to keep track of the indentation of each embedded chunk and summing it for each level of indentation. This requires a fair amount of bookkeeping that would not otherwise be necessary. The original prototype simply replaced each embedded chunk with the text from the chunk definition, all indenting information was lost. It worked for most languages, but not Python. In testing the program I used two languages, Python and J. I figured if I could make both of them work I would not have any problem with anything else. -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Wed, 5 May 2010 00:35:18 +1000 James Mills prolo...@shortcircuit.net.au wrote: In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. Harder. That was the big Aha! for me with Python. My first programming language was Fortran in 1969 so when I saw indentation as syntax I also recoiled in horror for about 0.5 seconds. However, I immediately realized that from now on I could be sure that if it looked right then it was right. for (x = 0; x++; x 10); printf(Current number is %d\n, x); Or... for (x = 0; x++; x 10); { printf(Current number is %d\n, x); } Oops. Looks right but isn't. Try to make that mistake in Python. Note untested - I wasn't about to fire up an editor, create a C program, add the includes, compile and run the a.out just to test this. Another way that Python excels. However, I am pretty sure that the above would compile. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Ed Keith e_...@yahoo.com wrote: Tabs are always a problem when writing Python. I get around this problem by setting my text editor to expand all tabs with spaces when editing Python, but I have had problems when coworkers have not done this. It's best not to trust others to do the right thing. I do trust Tools/ scripts/reindent.py more though :) Don't get me wrong, I love working in Python. It is one of my favorite languages, but it, like all other languages, is not perfect. I was genuinely interested in the problems you hit as I have some hazy projects in mind that I was planning on trying to handle via code generation. Context managers seem the best place to first try dealing with it. If you're interested I can keep you posted when I finally have some working code. Cheers for the clarification. -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Ed Keith, 04.05.2010 17:43: The PITA is having to keep track of the indentation of each embedded chunk and summing it for each level of indentation. This requires a fair amount of bookkeeping that would not otherwise be necessary. The original prototype simply replaced each embedded chunk with the text from the chunk definition, all indenting information was lost. It worked for most languages, but not Python. In testing the program I used two languages, Python and J. Well, then both of the language generators have benefited from your effort because the generated complete code is properly indented and therefore much more readable during debugging. I'd say it was worth it. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo ha scritto: Stefan Behnel ha scritto: superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? ok, since you asked for it, prepare yourself for a bit of a horror story ;-) i will answer in my next post ok here it is. i am not a programmer or it-guy in the first place; my job is as a high school teacher in a field only remotely connected with computers (math and physics). since i have some kind of computer literacy (as opposed to most of my colleagues), some years ago i was kindly asked to try and solve a simple particular problem, that is to write a program that generates math exercises (q+a) from an example taken from the textbook. for instance, this: %%TITLE:Sample worksheet %% %%SCHEMA:\lim_{x \to A} %%SCHEMA:\frac %%SCHEMA:{x^3-A-Bx^2-ABx} %%SCHEMA:{x^3-Ax^2+Cx-AC}\\ %% %%ANS:FRAC %%ANSNUM:A^2+AB %%ANSDEN:A^2+C %% %%AMIN:1 %%AINC:1 %%AMAX:2 %%BMIN:3 %%BINC:1 %%BMAX:4 %%CMIN:2 %%CINC:1 %%CMAX:3 should generate this latex source document: \documentclass[a4paper,10pt,twocolumn,fleqn]{article} \title{Sample worksheet} \pagestyle{empty} \usepackage[italian]{babel} \usepackage{amsmath} \usepackage{amssymb} \usepackage{cancel} \usepackage{mathrsfs} \usepackage[dvips]{graphicx} \usepackage{eurosym} \usepackage{pstricks} \usepackage{pst-eucl} \usepackage{pst-poly} \usepackage{pst-plot} \frenchspacing \begin{document} \section*{\center{\framebox{Sample worksheet}}} \noindent \begin{enumerate} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+3x^2-4x} {x^3-x^2+2x-2}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+x^2-6x} {x^3-2x^2+2x-4}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+2x^2-8x} {x^3-2x^2+2x-4}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+2x^2-3x} {x^3-x^2+2x-2}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+2x^2-3x} {x^3-x^2+3x-3}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+3x^2-4x} {x^3-x^2+3x-3}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+x^2-6x} {x^3-2x^2+3x-6}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+2x^2-8x} {x^3-2x^2+3x-6}\\ \end{multline*} \end{enumerate} \subsection*{\center{Answers}} \begin{enumerate} \item \begin{displaymath} \frac{5}{3} \end{displaymath} \item \begin{displaymath} \frac{5}{3} \end{displaymath} \item \begin{displaymath} 2 \end{displaymath} \item \begin{displaymath} \frac{4}{3} \end{displaymath} \item \begin{displaymath} 1 \end{displaymath} \item \begin{displaymath} \frac{5}{4} \end{displaymath} \item \begin{displaymath} \frac{10}{7} \end{displaymath} \item \begin{displaymath} \frac{12}{7} \end{displaymath} \end{enumerate} \end{document} which in turn can be used to generate the following pdf file: http://www.datafilehost.com/download-cc88a19e.html fine huh? now, for the horror part. when i began putting down some code i thought that maybe it would take a couple of evenings to put up a working prototype, and i was w-r-o-n-g: 1) as i said i am not a professional 2) i decided to use bash shell as a core language for the parser/generator ( *sigh* ) 3) feautiritis soon crept in if some of you knows a bit about math and especially algebra, you will understand that some of the biggest problems in generating standard math notation in to cope with the various layers of traditions and innuendos: for example i could generate the string 2x which is fine; but what about 1x or -1x or 0x? and what about plus signs at the start of an expression (normally omitted)? when does a subexpression start? etc ... there are plenty of icompatible rules and as much as exceptions ... as you can see i had many problems to solve and i am not trained to cope with such issues from a programmatic standpoint. another thing is that for some features i intended to include i found convenient to use python (since it's the language i feel i am more at ease with), so i had to cope with template lines like this: %%SCHEMA:PYCODE1:import math ; print int(math.sqrt($A**2-2.*$A*$B)) or even worse: %%ANSFRCEMBPYC:PYCODE3:print mathrm{p.~st.~} , $C , ~longmapsto~ , $C**2*(3*$A+3*$B+$C) , ~mathrm{(max~loc.)}\\ to make a long story short: the whole program is now 4775 lines of bash code, written by an unqualified amateur under time pressure; sometimes i have to hand-modify it to get certain outputs as i expect them to be; this in turn breaks other subsystems. i am ashamed to post the code, and it is a true design nightmare. also it is offtopic (being bash). *but* it was and it is a wonderful experience to learn to program, to acknowledge weaknesses end strongnesses of various approaches, to better understand the structure of math notation, problem solving end teaching techniques. it is still work in progress
Re: Teaching Programming
On 5/3/2010 7:46 PM, cjw wrote: Nobody likes indentation at first, Speak for yourself, please. For two decades before I met Python, I indented code nicely whenever it was allowed. That option was one of the great advancements of Fortran77 over FortranIV. Coming from C, I was immediately glad to be done with those darn braces. tjr -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, 4 May 2010 17:00:11 +0200 Andre Engels andreeng...@gmail.com wrote: Although I have little or no experience with this, I still dare to say that I don't agree. The difference is that in C you do not _need_ to know where in the braces-defined hierarchy you are. You just embed or change a piece of code at the right location. In Python however you _do_ need to know how far your code is to be indented. Well, I'm afraid your lack of experience shows. Experienced C coders will tell you that one of the most annoying things is counting braces to make sure that you have the right number in the right places. In fact, they add indentation so that they can use the visual layout to check the brace layout. Braces are the added step. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, May 4, 2010 at 8:49 AM, D'Arcy J.M. Cain da...@druid.net wrote: On Wed, 5 May 2010 00:35:18 +1000 James Mills prolo...@shortcircuit.net.au wrote: In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. Harder. That was the big Aha! for me with Python. My first programming language was Fortran in 1969 so when I saw indentation as syntax I also recoiled in horror for about 0.5 seconds. The amount of mental scaring that Fortran has caused regarding indentation is astounding. Maybe the PSF should run re-education camps for Fortran programmers... :P However, I immediately realized that from now on I could be sure that if it looked right then it was right. for (x = 0; x++; x 10); printf(Current number is %d\n, x); Or... for (x = 0; x++; x 10); { printf(Current number is %d\n, x); } Oops. Looks right but isn't. Try to make that mistake in Python. Technically, that pitfall /could/ be eliminated if curly-braces languages simply always required the curly-braces for bodies and stopped special-casing the null body case, in which case both your examples would be syntax errors. Removing the special-casing of single-line bodies too would remove a further class of errors. However, I've yet to encounter a language that takes such an approach. Quite a pity. Cheers, Chris -- I've thought a lot about this. http://blog.rebertia.com/2010/01/24/of-braces-and-semicolons/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, May 4, 2010 at 8:52 AM, Stefan Behnel stefan...@behnel.de wrote: Ed Keith, 04.05.2010 17:43: The PITA is having to keep track of the indentation of each embedded chunk and summing it for each level of indentation. This requires a fair amount of bookkeeping that would not otherwise be necessary. The original prototype simply replaced each embedded chunk with the text from the chunk definition, all indenting information was lost. It worked for most languages, but not Python. In testing the program I used two languages, Python and J. Well, then both of the language generators have benefited from your effort because the generated complete code is properly indented and therefore much more readable during debugging. I'd say it was worth it. Though there are auto-re-indenting programs for curly-brace languages you know. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 5/4/2010 8:46 AM, superpollo wrote: but i do not think i can use it myself, since my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I think we can agree that Python (unlike C, for instance) is not good for writing non-humanly-readable one-unbounded-length-line code. That is contrary to its design goal. But I would think that you would have similar problems with other manditorily multiline languages, like Fortran and Basic. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Ethan Furman wrote: div class=moz-text-flowed style=font-family: -moz-fixedAndre Engels wrote: On Tue, May 4, 2010 at 4:35 PM, James Mills prolo...@shortcircuit.net.au wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith e_...@yahoo.com wrote: To deal with indentation I had to 1) keep track of indentation of all chunks of code embedded in the document and indent inserted chunks to the sum of all the indentation of the enclosing chunks. In my experience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. Although I have little or no experience with this, I still dare to say that I don't agree. The difference is that in C you do not _need_ to know where in the braces-defined hierarchy you are. You just embed or change a piece of code at the right location. In Python however you _do_ need to know how far your code is to be indented. And how do you know where the right location is? You have to figure it out from the different (nested) braces at the 'right' location. For me, at least, it's much easier to get that information from the already indented Python code, as opposed to indenting (and double-checking the indents) on the braces language. ~Ethan~ Much more important to be able to read code reliably than write it quickly. When I was heavily doing C++ I found myself wishing that incorrect indentation would be an error or at least a warning. And I hadn't ever heard of Python. When I did, I said About time! Of course, I was surrounded by many programmers who ignored any warning that the compiler produced, while I cranked up warnings to max, with pedantic. On one project I generated C++ code, about 20k lines. And it was all indented and commented. Most of that code went through the code generator twice. The source was a header file from outside my organization. The generator used that to create a new header, more detailed. Then the generator used that to create source headers that were actually used by the project. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Terry Reedy wrote: On 5/3/2010 7:46 PM, cjw wrote: Nobody likes indentation at first, Speak for yourself, please. For two decades before I met Python, I indented code nicely whenever it was allowed. That option was one of the great advancements of Fortran77 over FortranIV. Coming from C, I was immediately glad to be done with those darn braces. tjr Right. Somewhere in the 80's I read a paper in sigplan which demonstrated that indentation-only was sufficient to communicate the structure of a program.I immediately *knew* that was the right way to go. Sadly, I had to wait a decade or so before discovering Python in the mid 90's, but I never forgot that paper nor lost my eager anticipation waiting for language design to catch up with that idea. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo, 04.05.2010 17:55: since i have some kind of computer literacy (as opposed to most of my colleagues), some years ago i was kindly asked to try and solve a simple particular problem, that is to write a program that generates math exercises (q+a) from an example taken from the textbook. for instance, this: %%TITLE:Sample worksheet %% %%SCHEMA:\lim_{x \to A} %%SCHEMA:\frac %%SCHEMA:{x^3-A-Bx^2-ABx} %%SCHEMA:{x^3-Ax^2+Cx-AC}\\ %% %%ANS:FRAC %%ANSNUM:A^2+AB %%ANSDEN:A^2+C %% %%AMIN:1 %%AINC:1 %%AMAX:2 %%BMIN:3 %%BINC:1 %%BMAX:4 %%CMIN:2 %%CINC:1 %%CMAX:3 should generate this latex source document: \documentclass[a4paper,10pt,twocolumn,fleqn]{article} \title{Sample worksheet} \pagestyle{empty} \usepackage[italian]{babel} \usepackage{amsmath} \usepackage{amssymb} \usepackage{cancel} \usepackage{mathrsfs} \usepackage[dvips]{graphicx} \usepackage{eurosym} \usepackage{pstricks} \usepackage{pst-eucl} \usepackage{pst-poly} \usepackage{pst-plot} \frenchspacing \begin{document} \section*{\center{\framebox{Sample worksheet}}} \noindent \begin{enumerate} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+3x^2-4x} {x^3-x^2+2x-2}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+x^2-6x} {x^3-2x^2+2x-4}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+2x^2-8x} {x^3-2x^2+2x-4}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+2x^2-3x} {x^3-x^2+2x-2}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+2x^2-3x} {x^3-x^2+3x-3}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 1} \frac {x^3+3x^2-4x} {x^3-x^2+3x-3}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+x^2-6x} {x^3-2x^2+3x-6}\\ \end{multline*} \item \begin{multline*} \lim_{x \to 2} \frac {x^3+2x^2-8x} {x^3-2x^2+3x-6}\\ \end{multline*} \end{enumerate} \subsection*{\center{Answers}} \begin{enumerate} \item \begin{displaymath} \frac{5}{3} \end{displaymath} \item \begin{displaymath} \frac{5}{3} [...] I'm not exactly sure I understand the mapping between the two formats, but it seems to me that you'll need a proper math expression parser (with a strong emphasis on *parser*) for this. Math expressions are not exactly trivial (recursion, prefix/infix/postfix notations, functions), which is why 'real' programmers don't write parsers for them but download tested, working code for that from somewhere. another thing is that for some features i intended to include i found convenient to use python (since it's the language i feel i am more at ease with), so i had to cope with template lines like this: %%SCHEMA:PYCODE1:import math ; print int(math.sqrt($A**2-2.*$A*$B)) You should assure that the math module is always imported, and otherwise restrict the expressiveness to expressions (terms that result in a value), not arbitrary statements (executable commands that do things without returning anything). to make a long story short: the whole program is now 4775 lines of bash code, Argh! *but* it was and it is a wonderful experience to learn to program It does sound like you almost completely skipped over two very important programming lessons, though: reading code is harder than writing it (i.e. maintenance cost matters), and the best code is the code that you don't need to write (and debug and maintain). Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo ute...@esempio.net wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type help, copyright, credits or license for more information. a, b = 2, 3 print a + b if a b else a**b - b**2 -1 a, b = 3, 2 print a + b if a b else a**b - b**2 5 --James what if i want an elif clause? -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo ute...@esempio.net wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type help, copyright, credits or license for more information. a, b = 2, 3 print a + b if a b else a**b - b**2 -1 a, b = 3, 2 print a + b if a b else a**b - b**2 5 --James what if i want an elif clause? my first try obviously falied: print a + b if a b elif a=b WOW else a**b - b**2 File stdin, line 1 print a + b if a b elif a=b WOW else a**b - b**2 ^ SyntaxError: invalid syntax -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 5/4/2010 1:44 PM, Dennis Lee Bieber wrote: On Tue, 04 May 2010 12:06:10 -0400, Terry Reedytjre...@udel.edu declaimed the following in gmane.comp.python.general: Speak for yourself, please. For two decades before I met Python, I indented code nicely whenever it was allowed. That option was one of the great advancements of Fortran77 over FortranIV. Coming from C, I was immediately glad to be done with those darn braces. What kept you from indenting FORTRAN-IV? There was a several year gap with learning of 'structured programming' in between. Perhaps ignorance of both the possibility (no one did it, that I know of) and desirability. Glass screens made consistent indentation a lot easier that with cards and teletypes. The new structured block constructs made indentation more useful, too. -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
superpollo ha scritto: superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo ute...@esempio.net wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type help, copyright, credits or license for more information. a, b = 2, 3 print a + b if a b else a**b - b**2 -1 a, b = 3, 2 print a + b if a b else a**b - b**2 5 --James what if i want an elif clause? my first try obviously falied: print a + b if a b elif a=b WOW else a**b - b**2 File stdin, line 1 print a + b if a b elif a=b WOW else a**b - b**2 ^ SyntaxError: invalid syntax ok i got it: a,b=2,3 print a + b if a b else WOW if a b else a**b - b**2 WOW -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Tue, May 4, 2010 at 2:16 PM, superpollo ute...@esempio.net wrote: superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo ute...@esempio.net wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type help, copyright, credits or license for more information. a, b = 2, 3 print a + b if a b else a**b - b**2 -1 a, b = 3, 2 print a + b if a b else a**b - b**2 5 --James what if i want an elif clause? my first try obviously falied: print a + b if a b elif a=b WOW else a**b - b**2 File stdin, line 1 print a + b if a b elif a=b WOW else a**b - b**2 ^ SyntaxError: invalid syntax That's because this technically isn't an if statement. It's the ternary conditional expression. If you want multiple conditions, you have to repeat the expression print a+b if a b else WOW if a==b else a**b - b**2 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
--- On Tue, 5/4/10, Stefan Behnel stefan...@behnel.de wrote: From: Stefan Behnel stefan...@behnel.de Subject: Re: Teaching Programming To: python-list@python.org Date: Tuesday, May 4, 2010, 11:52 AM Ed Keith, 04.05.2010 17:43: The PITA is having to keep track of the indentation of each embedded chunk and summing it for each level of indentation. This requires a fair amount of bookkeeping that would not otherwise be necessary. The original prototype simply replaced each embedded chunk with the text from the chunk definition, all indenting information was lost. It worked for most languages, but not Python. In testing the program I used two languages, Python and J. Well, then both of the language generators have benefited from your effort because the generated complete code is properly indented and therefore much more readable during debugging. I'd say it was worth it. Stefan -- http://mail.python.org/mailman/listinfo/python-list I agree, but some propellants of literate programming would not. Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code. -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Ed Keith e_...@yahoo.com wrote: Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code. This is my biggest issue with Knuth's view of literate programming. If the generated source isn't readable, am I just supposed to trust it? How can I tell if an error lies in my expression of the algorithm or in the code generation itself? -- http://mail.python.org/mailman/listinfo/python-list
Teaching Programming
Dear Friends, I'm looking for some help from the Python community. I hope this is the right place to ask for information. I'm putting together a website aimed at high school students and teachers, and would like to make sure the following page is as good as possible: http://programming.dojo.net.nz/languages/python/index In particular, Why would I learn this language? section needs to have a few paragraphs. I don't use Python predominantly so I hoped that you could provide the main reasons why Python is a language someone would want to learn about. Any other suggestions or ideas for the Python page would be fantastic, and any suggestions to other pages in general is also very helpful. http://programming.dojo.net.nz/ Kind regards, Samuel -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Mon, May 3, 2010 at 5:05 AM, Samuel Williams space.ship.travel...@gmail.com wrote: Dear Friends, I'm looking for some help from the Python community. I hope this is the right place to ask for information. I'm putting together a website aimed at high school students and teachers, and would like to make sure the following page is as good as possible: http://programming.dojo.net.nz/languages/python/index In particular, Why would I learn this language? section needs to have a few paragraphs. I don't use Python predominantly so I hoped that you could provide the main reasons why Python is a language someone would want to learn about. - Significant use in certain applications areas: * Web programming (common frameworks include Django TurboGears) * Scientific and numerical computing (see SciPy and Numeric) - Large batteries-included standard library, with a large number of third-party libraries also available - Used by Industrial Light and Magic, Google/YouTube, and other big names (http://www.python.org/about/success/) - A very clean syntax and elegant design, compared to other languages Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On Mon, May 3, 2010 at 5:29 AM, Chris Rebert c...@rebertia.com wrote: On Mon, May 3, 2010 at 5:05 AM, Samuel Williams space.ship.travel...@gmail.com wrote: Dear Friends, I'm looking for some help from the Python community. I hope this is the right place to ask for information. I'm putting together a website aimed at high school students and teachers, and would like to make sure the following page is as good as possible: http://programming.dojo.net.nz/languages/python/index In particular, Why would I learn this language? section needs to have a few paragraphs. I don't use Python predominantly so I hoped that you could provide the main reasons why Python is a language someone would want to learn about. snip - A very clean syntax and elegant design, compared to other languages Also, I take issue with your classifying Python as orange with regard to Is the general syntax simple and concise? on http://programming.dojo.net.nz/resources/programming-language-comparison/index Python's syntax is at least as simple, if not simpler, than Ruby's, which you rate as green. Ruby may be /slightly/ more concise than Python in certain cases due to its Perl influences, but those instances of specialized syntax also make it more complex. To wit, I refer you to http://webcache.googleusercontent.com/search?q=cache:dyugd_KlqvcJ:blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar+ruby+grammar+visualizationcd=1hl=enct=clnkgl=us Note the complexity of the graph for Ruby's grammar. By comparison, here is the same graph for Python (generated from a file linked to in the post's comment thread): http://rebertia.com/images/python_grammar_graph.png (Disclaimer: Neither of the graphs are current.) Additionally, you rate Python orange but Perl green for Does the language provide a useful and consistent set of object oriented constructs?. Could you explain your reasoning for this? While neither Python nor Perl have the level of object-oriented purity of Ruby or Smalltalk, my understanding is that short of using CPAN libraries for Perl or dealing in Perl 6, Perl and Python have a substantially similar object model, so I don't how Python could rate below Perl in this area. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Dear Chris, Thanks for reading further into the site. Yes, it is complicated to provide a good comparison. It isn't always accurate and I welcome feedback. Please be aware that orange does not mean problem - it simply means take note that there may be potential issues that you need to consider. It is highly subjective, so I appreciate your feedback. The red dot is when there is definitely an issue that needs to be taken into consideration. It isn't Okay, Warning, Error because it isn't possible to make this kind of judgement without being omnipotent. There are several reason why I decided to rate the syntax as not being simple. 1) Indentation model is not appreciated by everyone - I think its a good model, but feedback from some other people has been that they don't like it. Also, I've had perfectly good Python code fall to bits after editing in a different editor. I'm not saying that this was the fault of Python, but in an educational context it might be a problem, since people are fairly limited and don't understand these issues. 2) I don't think that the list comprehension integrates well with the rest of the language. It is an additional syntactic construct which seems to be separate from the rest of the language. It would be nice if list comprehension was implemented in a way that was more general, using a general closure syntax for example. This is just my opinion, and it might not be valid (I don't research this point very heavily). I appreciate that in general the Python syntax is good and concise. It is hard. Some teacher might want to consider these issues more carefully. Do you think I should change that spot to green? I don't have a problem with doing that, as long as it makes sense. Thanks for providing the syntax images, they are very interesting. With regards to Perl, yes, this is probably something I need to investigate further. It is not always easy to do a comparison of this nature. From my experience, Perl generally seems to have a robust object model that is consistently implemented (even if the syntax is pretty wonky at times). However, in a sense, it is no better or worse than Python implementation... so why is it green dot? Do you think I should change Perl to orange or Python to green. The main criteria is whether it is going to be an issue in an educational context - this means, for new programmers, or those who might make error easily (syntax, semantic), etc. Also, I wonder if Visual Basic needs to be reevaluated on this criteria too. I guess what is important is the relative importance. I will bring this issue up on the Perl mailing list in order to get advice. Would you recommend changing Perl to orange? Thanks for your well thought out response, it is very helpful. Kind regards, Samuel On 4/05/2010, at 1:06 AM, Chris Rebert wrote: On Mon, May 3, 2010 at 5:29 AM, Chris Rebert c...@rebertia.com wrote: On Mon, May 3, 2010 at 5:05 AM, Samuel Williams space.ship.travel...@gmail.com wrote: Dear Friends, I'm looking for some help from the Python community. I hope this is the right place to ask for information. I'm putting together a website aimed at high school students and teachers, and would like to make sure the following page is as good as possible: http://programming.dojo.net.nz/languages/python/index In particular, Why would I learn this language? section needs to have a few paragraphs. I don't use Python predominantly so I hoped that you could provide the main reasons why Python is a language someone would want to learn about. snip - A very clean syntax and elegant design, compared to other languages Also, I take issue with your classifying Python as orange with regard to Is the general syntax simple and concise? on http://programming.dojo.net.nz/resources/programming-language-comparison/index Python's syntax is at least as simple, if not simpler, than Ruby's, which you rate as green. Ruby may be /slightly/ more concise than Python in certain cases due to its Perl influences, but those instances of specialized syntax also make it more complex. To wit, I refer you to http://webcache.googleusercontent.com/search?q=cache:dyugd_KlqvcJ:blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar+ruby+grammar+visualizationcd=1hl=enct=clnkgl=us Note the complexity of the graph for Ruby's grammar. By comparison, here is the same graph for Python (generated from a file linked to in the post's comment thread): http://rebertia.com/images/python_grammar_graph.png (Disclaimer: Neither of the graphs are current.) Additionally, you rate Python orange but Perl green for Does the language provide a useful and consistent set of object oriented constructs?. Could you explain your reasoning for this? While neither Python nor Perl have the level of object-oriented purity of Ruby or Smalltalk, my understanding is that short of using CPAN libraries for Perl or dealing in Perl 6, Perl and
Re: Teaching Programming
On 4/05/2010, at 1:06 AM, Chris Rebert wrote: On Mon, May 3, 2010 at 5:29 AM, Chris Rebert c...@rebertia.com wrote: On Mon, May 3, 2010 at 5:05 AM, Samuel Williams space.ship.travel...@gmail.com wrote: snip In particular, Why would I learn this language? section needs to have a few paragraphs. I don't use Python predominantly so I hoped that you could provide the main reasons why Python is a language someone would want to learn about. snip - A very clean syntax and elegant design, compared to other languages Also, I take issue with your classifying Python as orange with regard to Is the general syntax simple and concise? on http://programming.dojo.net.nz/resources/programming-language-comparison/index Python's syntax is at least as simple, if not simpler, than Ruby's, which you rate as green. Ruby may be /slightly/ more concise than Python in certain cases due to its Perl influences, but those instances of specialized syntax also make it more complex. To wit, I refer you to http://webcache.googleusercontent.com/search?q=cache:dyugd_KlqvcJ:blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar+ruby+grammar+visualizationcd=1hl=enct=clnkgl=us Note the complexity of the graph for Ruby's grammar. By comparison, here is the same graph for Python (generated from a file linked to in the post's comment thread): http://rebertia.com/images/python_grammar_graph.png (Disclaimer: Neither of the graphs are current.) Additionally, you rate Python orange but Perl green for Does the language provide a useful and consistent set of object oriented constructs?. Could you explain your reasoning for this? While neither Python nor Perl have the level of object-oriented purity of Ruby or Smalltalk, my understanding is that short of using CPAN libraries for Perl or dealing in Perl 6, Perl and Python have a substantially similar object model, so I don't how Python could rate below Perl in this area. On Mon, May 3, 2010 at 6:38 AM, Samuel Williams space.ship.travel...@gmail.com wrote: Dear Chris, Thanks for reading further into the site. Yes, it is complicated to provide a good comparison. It isn't always accurate and I welcome feedback. Please be aware that orange does not mean problem - it simply means take note that there may be potential issues that you need to consider. It is highly subjective, so I appreciate your feedback. The red dot is when there is definitely an issue that needs to be taken into consideration. It isn't Okay, Warning, Error because it isn't possible to make this kind of judgement without being omnipotent. There are several reason why I decided to rate the syntax as not being simple. 1) Indentation model is not appreciated by everyone - I think its a good model, but feedback from some other people has been that they don't like it. Also, I've had perfectly good Python code fall to bits after editing in a different editor. I'm not saying that this was the fault of Python, but in an educational context it might be a problem, since people are fairly limited and don't understand these issues. 2) I don't think that the list comprehension integrates well with the rest of the language. It is an additional syntactic construct which seems to be separate from the rest of the language. It would be nice if list comprehension was implemented in a way that was more general, using a general closure syntax for example. This is just my opinion, and it might not be valid (I don't research this point very heavily). I appreciate that in general the Python syntax is good and concise. It is hard. Some teacher might want to consider these issues more carefully. Do you think I should change that spot to green? I don't have a problem with doing that, as long as it makes sense. Yes, I do think it ought to be green, though I admit I'm not unbiased on this. I will point out that (1) does not seem related to simplicity and conciseness, which is what that row in the comparison claims to be about. With regards to Perl, yes, this is probably something I need to investigate further. It is not always easy to do a comparison of this nature. From my experience, Perl generally seems to have a robust object model that is consistently implemented (even if the syntax is pretty wonky at times). However, in a sense, it is no better or worse than Python implementation... so why is it green dot? Do you think I should change Perl to orange or Python to green. I'm unsure, but in either case, at least based on my limited knowledge of Perl 5, it again seems rather strange for Python Perl to not be rated approximately the same in this area (if anything, I'd think Perl might be slightly worse off due to its syntax; but again, I'm not unbiased and my Perl knowledge is limited). Cheers, Chris -- Avoid top-posting (google it) http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
Dear Chris, I will take your feedback into consideration and let you know the outcome when I have time to think about it. Again, I appreciate your thoughts. Thanks for taking the time to think about the comparison chart. Kind regards, Samuel On 4/05/2010, at 1:58 AM, Chris Rebert wrote: I appreciate that in general the Python syntax is good and concise. It is hard. Some teacher might want to consider these issues more carefully. Do you think I should change that spot to green? I don't have a problem with doing that, as long as it makes sense. Yes, I do think it ought to be green, though I admit I'm not unbiased on this. I will point out that (1) does not seem related to simplicity and conciseness, which is what that row in the comparison claims to be about. With regards to Perl, yes, this is probably something I need to investigate further. It is not always easy to do a comparison of this nature. From my experience, Perl generally seems to have a robust object model that is consistently implemented (even if the syntax is pretty wonky at times). However, in a sense, it is no better or worse than Python implementation... so why is it green dot? Do you think I should change Perl to orange or Python to green. I'm unsure, but in either case, at least based on my limited knowledge of Perl 5, it again seems rather strange for Python Perl to not be rated approximately the same in this area (if anything, I'd think Perl might be slightly worse off due to its syntax; but again, I'm not unbiased and my Perl knowledge is limited). -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 05/03/10 14:29, Chris Rebert wrote: On Mon, May 3, 2010 at 5:05 AM, Samuel Williams space.ship.travel...@gmail.com wrote: Dear Friends, I'm looking for some help from the Python community. I hope this is the right place to ask for information. I'm putting together a website aimed at high school students and teachers, and would like to make sure the following page is as good as possible: http://programming.dojo.net.nz/languages/python/index In particular, Why would I learn this language? section needs to have a few paragraphs. I don't use Python predominantly so I hoped that you could provide the main reasons why Python is a language someone would want to learn about. - Significant use in certain applications areas: * Web programming (common frameworks include Django TurboGears) * Scientific and numerical computing (see SciPy and Numeric) - Large batteries-included standard library, with a large number of third-party libraries also available - Used by Industrial Light and Magic, Google/YouTube, and other big names (http://www.python.org/about/success/) - A very clean syntax and elegant design, compared to other languages I've used Perl for quite some years before I switched to Python. I've been burnt by Perl. There so many hidden variables and states which influence the outcome of nearly each statement in Perl, that it is hard to understand and debug unless you're using it several hours a day (each day). What convinced me is clearly written in http://www.linuxjournal.com/article/3882 Please have a look at it, Helmut. (I'm teaching programming for more than 15 years) -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 5/3/2010 9:38 AM, Samuel Williams wrote: Dear Chris, Thanks for reading further into the site. Yes, it is complicated to provide a good comparison. It isn't always accurate and I welcome feedback. Please be aware that orange does not mean problem - it simply means take note that there may be potential issues that you need to consider. It is highly subjective, so I appreciate your feedback. The red dot is when there is definitely an issue that needs to be taken into consideration. It isn't Okay, Warning, Error because it isn't possible to make this kind of judgement without being omnipotent. There are several reason why I decided to rate the syntax as not being simple. 1) Indentation model is not appreciated by everyone - I Appreciation is orthogonal to simplicity. think its a good model, but feedback from some other people has been that they don't like it. Also, I've had perfectly good Python code fall to bits after editing in a different editor. I'm not saying that I view this is a consequence of simplicity. Python does not have the complexity of usually redundant (but possibly contradictory) backup indication of structure. So to me, you are rating Python as not simple because it is too simple for some people for some purposes ;-). this was the fault of Python, but in an educational context it might be a problem, since people are fairly limited and don't understand these issues. 2) I don't think that the list comprehension integrates well with the rest of the language. It is an additional syntactic construct which seems to be separate from the rest of the language. It would be nice if list comprehension was implemented in a way that was more general, using a general closure syntax for example. This is List comprehensions have been generalized in Python 3 to generator expressions and list/set/dict comprehensions. I do not know whether you rate Py2 or Py3 at your site, but for 'should I learn this language' comparision, Py3 would be fairest. just my opinion, and it might not be valid (I don't research this point very heavily). I appreciate that in general the Python syntax is good and concise. It is hard. Some teacher might want to consider these issues more carefully. Do you think I should change that spot to green? I don't have a problem with doing that, as long as it makes sense. Thanks for providing the syntax images, they are very interesting. I chose Python over Perl (over a decade ago) partly because it seemed to me them to have a simpler, more consistent object model and system. Since then, the user class system has been integrated with the builtin type system, and the older separate class system eliminated in Python3, which, again, simplifies things. It is perhaps worth noting that Python's object model, and consequent function calling protocol, dates back at least to Barbara Liskov's CLU language. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
To Samuel Williams:(and other interested ;-) If you want to consider Python in education, I would encourage you have a look at http://www.python.org/community/sigs/current/edu-sig/ I think you will find that there are quite a few resources available - perhaps more than you are aware of. And, I don't think that because some people do not like the indentation strategy is a valid reason not to consider that Python's syntax is concise and simple. Actually, I would almost argue for the contrary. Indentation indicate programming structure/logic very clearly, without the need for arbitrary keywords and other punctuation symbols. There are very few keywords in the language. You indicate that Python programs are readable. They are also known to be short (much shorter than some other languages). André -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Programming
On 03-May-10 09:38 AM, Samuel Williams wrote: Dear Chris, Thanks for reading further into the site. Yes, it is complicated to provide a good comparison. It isn't always accurate and I welcome feedback. Please be aware that orange does not mean problem - it simply means take note that there may be potential issues that you need to consider. It is highly subjective, so I appreciate your feedback. The red dot is when there is definitely an issue that needs to be taken into consideration. It isn't Okay, Warning, Error because it isn't possible to make this kind of judgement without being omnipotent. There are several reason why I decided to rate the syntax as not being simple. 1) Indentation model is not appreciated by everyone - I think its a good model, but feedback from some other people has been that they don't like it. Also, I've had perfectly good Python code fall to bits after editing in a different editor. I'm not saying that this was the fault of Python, but in an educational context it might be a problem, since people are fairly limited and don't understand these issues. Nobody likes indentation at first, it is different. There is no begin/end and not {}. That feeling might last for an hour. People welcome the absence of clutter. Indentation makes it easier to read and understand the code. Coding errors are easily found with a good IDE, such as PyScripter Colin W. 2) I don't think that the list comprehension integrates well with the rest of the language. It is an additional syntactic construct which seems to be separate from the rest of the language. It would be nice if list comprehension was implemented in a way that was more general, using a general closure syntax for example. This is just my opinion, and it might not be valid (I don't research this point very heavily). I appreciate that in general the Python syntax is good and concise. It is hard. Some teacher might want to consider these issues more carefully. Do you think I should change that spot to green? I don't have a problem with doing that, as long as it makes sense. Thanks for providing the syntax images, they are very interesting. With regards to Perl, yes, this is probably something I need to investigate further. It is not always easy to do a comparison of this nature. From my experience, Perl generally seems to have a robust object model that is consistently implemented (even if the syntax is pretty wonky at times). However, in a sense, it is no better or worse than Python implementation... so why is it green dot? Do you think I should change Perl to orange or Python to green. The main criteria is whether it is going to be an issue in an educational context - this means, for new programmers, or those who might make error easily (syntax, semantic), etc. Also, I wonder if Visual Basic needs to be reevaluated on this criteria too. I guess what is important is the relative importance. I will bring this issue up on the Perl mailing list in order to get advice. Would you recommend changing Perl to orange? Thanks for your well thought out response, it is very helpful. Kind regards, Samuel On 4/05/2010, at 1:06 AM, Chris Rebert wrote: On Mon, May 3, 2010 at 5:29 AM, Chris Rebertc...@rebertia.com wrote: On Mon, May 3, 2010 at 5:05 AM, Samuel Williams space.ship.travel...@gmail.com wrote: Dear Friends, I'm looking for some help from the Python community. I hope this is the right place to ask for information. I'm putting together a website aimed at high school students and teachers, and would like to make sure the following page is as good as possible: http://programming.dojo.net.nz/languages/python/index In particular, Why would I learn this language? section needs to have a few paragraphs. I don't use Python predominantly so I hoped that you could provide the main reasons why Python is a language someone would want to learn about. snip - A very clean syntax and elegant design, compared to other languages Also, I take issue with your classifying Python as orange with regard to Is the general syntax simple and concise? on http://programming.dojo.net.nz/resources/programming-language-comparison/index Python's syntax is at least as simple, if not simpler, than Ruby's, which you rate as green. Ruby may be /slightly/ more concise than Python in certain cases due to its Perl influences, but those instances of specialized syntax also make it more complex. To wit, I refer you to http://webcache.googleusercontent.com/search?q=cache:dyugd_KlqvcJ:blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar+ruby+grammar+visualizationcd=1hl=enct=clnkgl=us Note the complexity of the graph for Ruby's grammar. By comparison, here is the same graph for Python (generated from a file linked to in the post's comment thread): http://rebertia.com/images/python_grammar_graph.png (Disclaimer: Neither of the graphs are current.) Additionally, you rate Python orange but Perl
Re: Teaching Programming
Nobody likes indentation at first, it is different. For what it's worth, I didn't have a programming background, and I liked Python's indentation right from the start. I was used to thinking in terms of indentation from writing and word processing documents with subordinate sections, so I found it very natural (and already had a well-developed tab finger). On the other hand, curly braces always have struck me as visual clutter. -- http://mail.python.org/mailman/listinfo/python-list