Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Teaching Programming

Reply
Thread Tools

Re: Teaching Programming

 
 
Ed Keith
Guest
Posts: n/a
 
      05-04-2010
--- On Tue, 5/4/10, Stefan Behnel <(E-Mail Removed)> wrote:

> From: Stefan Behnel <(E-Mail Removed)>
> Subject: Re: Teaching Programming
> To: http://www.velocityreviews.com/forums/(E-Mail Removed)
> 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-Mail Removed)

Blog: edkeith.blogspot.com




 
Reply With Quote
 
 
 
 
alex23
Guest
Posts: n/a
 
      05-05-2010
Ed Keith <(E-Mail Removed)> 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?

 
Reply With Quote
 
 
 
 
Dave Angel
Guest
Posts: n/a
 
      05-05-2010
alex23 wrote:
> Ed Keith <(E-Mail Removed)> 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
 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      05-05-2010
On 5/5/2010 4:50 AM, Dave Angel wrote:
> alex23 wrote:
>> Ed Keith <(E-Mail Removed)> 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.

 
Reply With Quote
 
Gregory Ewing
Guest
Posts: n/a
 
      05-08-2010
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Teaching Programming Samuel Williams Python 22 05-05-2010 10:01 PM
Re: Teaching Programming Ed Keith Python 8 05-04-2010 04:22 PM
Re: Teaching Programming Chris Rebert Python 0 05-04-2010 04:13 PM
Announcing Wing IDE 101 for teaching intro programming courses Wingware Python 0 08-03-2007 07:28 PM
teaching programming to children andy@post.tau.ac.il Python 14 12-18-2003 01:13 AM



Advertisments