Re: Teaching Programming

2010-05-07 Thread Gregory Ewing
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

Re: Teaching Programming

2010-05-05 Thread superpollo
Martin P. Hellwig ha scritto: On 05/04/10 12:59, superpollo wrote: Martin P. Hellwig ha scritto: 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 s

Re: Teaching Programming

2010-05-05 Thread Martin P. Hellwig
On 05/04/10 12:59, superpollo wrote: Martin P. Hellwig ha scritto: 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 exampl

Re: Teaching Programming

2010-05-05 Thread Terry Reedy
On 5/5/2010 4:50 AM, Dave Angel wrote: alex23 wrote: Ed Keith 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

Re: Teaching Programming

2010-05-05 Thread Ed Keith
--- On Tue, 5/4/10, alex23 wrote: > From: alex23 > Subject: Re: Teaching Programming > To: python-list@python.org > Date: Tuesday, May 4, 2010, 8:47 PM > Ed Keith > wrote: > > Knuth wanted the generated source to be unreadable, so > people would not be tempted

Re: Teaching Programming

2010-05-05 Thread Dave Angel
alex23 wrote: Ed Keith 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

Re: Teaching Programming

2010-05-04 Thread alex23
Ed Keith 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 erro

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > 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 embedd

Re: Teaching Programming

2010-05-04 Thread Benjamin Kaplan
On Tue, May 4, 2010 at 2:16 PM, superpollo wrote: > superpollo ha scritto: >> >> James Mills ha scritto: >>> >>> On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem:

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo 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 2

Re: Teaching Programming

2010-05-04 Thread Terry Reedy
On 5/4/2010 1:44 PM, Dennis Lee Bieber wrote: On Tue, 04 May 2010 12:06:10 -0400, Terry Reedy 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 a

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo 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.

Re: Teaching Programming

2010-05-04 Thread superpollo
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo 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

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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

Re: Teaching Programming

2010-05-04 Thread Gary Herron
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

Re: Teaching Programming

2010-05-04 Thread Dave Angel
Ethan Furman wrote: Andre Engels wrote: On Tue, May 4, 2010 at 4:35 PM, James Mills wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith 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

Re: Teaching Programming

2010-05-04 Thread Terry Reedy
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-un

Re: Teaching Programming

2010-05-04 Thread Chris Rebert
On Tue, May 4, 2010 at 8:52 AM, Stefan Behnel 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. >>

Re: Teaching Programming

2010-05-04 Thread Chris Rebert
On Tue, May 4, 2010 at 8:49 AM, D'Arcy J.M. Cain wrote: > On Wed, 5 May 2010 00:35:18 +1000 > James Mills 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

Re: Teaching Programming

2010-05-04 Thread D'Arcy J.M. Cain
On Tue, 4 May 2010 17:00:11 +0200 Andre Engels 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

Re: Teaching Programming

2010-05-04 Thread Terry Reedy
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 gla

Re: Teaching Programming

2010-05-04 Thread superpollo
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 ask

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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 t

Re: Teaching Programming

2010-05-04 Thread alex23
Ed Keith 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

Re: Teaching Programming

2010-05-04 Thread D'Arcy J.M. Cain
On Wed, 5 May 2010 00:35:18 +1000 James Mills 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

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > 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

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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

Re: Teaching Programming

2010-05-04 Thread Ethan Furman
Andre Engels wrote: On Tue, May 4, 2010 at 4:35 PM, James Mills wrote: On Wed, May 5, 2010 at 12:21 AM, Ed Keith 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 i

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Andre Engels wrote: > From: Andre Engels > Subject: Re: Teaching Programming > To: "James Mills" > Cc: "python list" > Date: Tuesday, May 4, 2010, 11:00 AM > On Tue, May 4, 2010 at 4:35 PM, James > Mills > > wrote: > &g

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, James Mills wrote: > From: James Mills > Subject: Re: Teaching Programming > To: "python list" > Date: Tuesday, May 4, 2010, 10:35 AM > On Wed, May 5, 2010 at 12:21 AM, Ed > Keith > wrote: > > To deal with indentation I had to > >

Re: Teaching Programming

2010-05-04 Thread Andre Engels
On Tue, May 4, 2010 at 4:35 PM, James Mills wrote: > On Wed, May 5, 2010 at 12:21 AM, Ed Keith 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 >>      indentati

Re: Teaching Programming

2010-05-04 Thread James Mills
On Wed, May 5, 2010 at 12:21 AM, Ed Keith 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-indent

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, alex23 wrote: > From: alex23 > Subject: Re: Teaching Programming > To: python-list@python.org > Date: Tuesday, May 4, 2010, 10:06 AM > Ed Keith > wrote: > > For more information on Literate Programming in > general see the following links. >

Re: Teaching Programming

2010-05-04 Thread alex23
Ed Keith 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

2010-05-04 Thread superpollo
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 yourse

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > 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.

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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

2010-05-04 Thread superpollo
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 [.

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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.

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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 provi

Re: Teaching Programming

2010-05-04 Thread superpollo
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo 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

Re: Teaching Programming

2010-05-04 Thread Benjamin Kaplan
On Tue, May 4, 2010 at 7:23 AM, superpollo 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. ther

Re: Teaching Programming

2010-05-04 Thread Ed Keith
--- On Tue, 5/4/10, Stefan Behnel wrote: > From: Stefan Behnel > 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

Re: Teaching Programming

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:56 PM, superpollo 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", "cr

Re: Teaching Programming

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:43 PM, Stefan Behnel 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 A>B: >> ... print A+B >> ... else: >> ... print A**B-B**2 >> ... >>

Re: Teaching Programming

2010-05-04 Thread superpollo
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. there might be problems if for example you generate code from a one-line template. Well a one-l

Re: Teaching Programming

2010-05-04 Thread superpollo
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 ru

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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.

Re: Teaching Programming

2010-05-04 Thread Martin P. Hellwig
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. there might be problems if for example you generate code from a one-line template. Well a one-line template code generator are

Re: Teaching Programming

2010-05-04 Thread superpollo
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 tem

Re: Teaching Programming

2010-05-04 Thread Stefan Behnel
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

Re: Teaching Programming

2010-05-04 Thread superpollo
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. t

Re: Teaching Programming

2010-05-04 Thread Samuel Williams
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 ot

Re: Teaching Programming

2010-05-04 Thread Jean-Michel Pichavant
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

Re: Teaching Programming

2010-05-03 Thread CM
> 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 fo

Re: Teaching Programming

2010-05-03 Thread cjw
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 m

Re: Teaching Programming

2010-05-03 Thread André
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,

Re: Teaching Programming

2010-05-03 Thread Terry Reedy
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 b

Re: Teaching Programming

2010-05-03 Thread Helmut Jarausch
f 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

Re: Teaching Programming

2010-05-03 Thread Samuel Williams
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

Re: Teaching Programming

2010-05-03 Thread Chris Rebert
> On 4/05/2010, at 1:06 AM, Chris Rebert wrote: >> On Mon, May 3, 2010 at 5:29 AM, Chris Rebert wrote: >>> On Mon, May 3, 2010 at 5:05 AM, Samuel Williams >>> wrote: In particular, "Why would I learn this language?" section needs to have a few paragraphs. I don't use Python predominant

Re: Teaching Programming

2010-05-03 Thread Samuel Williams
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

Re: Teaching Programming

2010-05-03 Thread Chris Rebert
On Mon, May 3, 2010 at 5:29 AM, Chris Rebert wrote: > On Mon, May 3, 2010 at 5:05 AM, Samuel Williams > 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 s

Re: Teaching Programming

2010-05-03 Thread Chris Rebert
On Mon, May 3, 2010 at 5:05 AM, Samuel Williams 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

Teaching Programming

2010-05-03 Thread Samuel Williams
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