Autocoding project proposal.

Kragen Sitaker kragen at pobox.com
Sun Jan 27 22:56:24 EST 2002


Jonathan Hogg <jonathan at onegoodidea.com> writes:

> On 27/1/2002 17:37, in article slrna58en4.4cd.philh at comuno.freeserve.co.uk,
> "phil hunt" <philh at comuno.freeserve.co.uk> wrote:
> > (2) The python language is explicitly designed to be easy to program in.
> 
> ... Python, but it's still designed for computer
> programmers....
>     def count( file ):
>         i = 0
>         for line in file:
>             i = i + 1
>         return i
> 
>     count( open('foo.txt') )
>...
> Surely what would make more sense to a non-programmer is something like
> (using pseudo-AppleScript):
> 
>     get the count of the lines of file 'foo.txt'

The Python of this is len(open('foo.txt').readlines()) --- not as
Englishy, and therefore not as easy to learn to read, but not any
harder to learn to write, I think.

The real point you make above is that functional programs are simpler
than procedural ones, but that shouldn't be news to anyone.  The only
debates over functional programming are (a) can functional programs
run fast enough? and (b) can people understand functional programs
dealing with abstract concepts?

> I don't want to come across as some mad AppleScript zealot. My point is not
> that AppleScript is fantastic, but that it's the closest I've seen to
> something that a non-computer-geek friend might be able to read and make
> some sense of. It still falls down on a lot of things - some computing
> concepts don't map very well to natural terms.

COBOL has the same advantage, really.  Not that I'd want to use or
learn COBOL, but if I had to write a program to do some kind of simple
calculation and it needed to be readable by nontechnical people, COBOL
would be the tool for the job!

> We've managed to make writing letters, sending emails, and surfing the web
> easy enough for Grandma to use, but programming a computer is fundamentally
> no easier than it was when we toggled switches or punched cards.

I suppose it depends on where you put your fundament, but it seems
that we have to worry about fewer irrelevant things these days.




More information about the Python-list mailing list