[Edu-sig] measuring python...

Jason Cunliffe Jason Cunliffe" <jasonic@nomadics.org
Sat, 29 Sep 2001 19:05:38 -0700


PYTHON
Python: I love for its readability on two levels:
1. - consistent syntax and mostly very clear logical flow top to bottom.
2. - friendly visual syntax mainly derived from the obligatory but
liberating white-space indentation

Scrolling down and scanning large chunks of python code, I detect a well
tempered rhythm. The blocks, indentations, naming and repetition reveal a
similar construct pattern across myriad examples.
This is a very 'un-scientific' comment I realize, but one perhaps worthwhile
investigating..

I love Python's writability for two main reasons also:
a. -  executable pseudo-code
      .. to me Python is very sculptural. You start by naming and imagining
things and relationships and then proceed to sketch them in. With time and
skill you just keep going, implementing details and functionality. Play and
exploration are encouraged, as is throwing things away when one has a better
insight. I think this stems from the fact that because everything in Python
is an object, one must name it, and doing so makes it exist. you might argue
that is true for all languages, and I would agree, but Python seems very
direct in the workflow from imagine, to model to further implementation adn
naming and objects [tokens??]are present in the same manner every step of
the way.

b. -  dictionaries and named arguments
      ..yes thank you Guido! I argue named arguments are a major reason why
Python is readable and makes a great learning language. You take your
semantic token map with you and share it liberally with all who come after.
Dictionaries are the engine behind this. What you call something or assign a
value/meaning too is more important than where it comes in the sequence, and
we people should not be persecuted by having to interpret lists of
unidentified symbols.

Once you know how to 'read' a little Python, you know how to read most
Python. Ditto writing. There is evident a clear design pattern here, which
apart from a few characterful idiosyncrasies, works very well.

This I think makes it especially suitable for teaching programming. And I
agree with Kirby, it is a very cosmopolitan language. I would stress also
that any language for people to learn is only as good as its community. Even
if a small tribe, is it a living growing language? I believe the mood and
quality of its culture is especially crucial for learning computer
programming.

[From age 9, I studied Latin for 5 years, but never was any teacher able to
articulate successfully why we should study Latin, despite the daily
question from some prankster in class. I am glad I studied Latin, but wish
to god that at the time there had been a more cosmopolitan context provided
for our study.. connections to the past, present and future, common
concepts, omni present structure, etc.. At 12 years old I doubt if I would
have responded this vocabulary, but certainly to the meaning of them.

As you may have noted, I have been having list of fun exploring Rebol. It
has provided some valuable fresh perspectives.

REBOL notes
Rebol is interesting in parallel to Python because readability is also a
prime design goal.
http://www.rebol.org
Rebol puts great emphasis on  minimal simplicity of syntax and a readability
from left to write which hopes to attain a pragmatic but simplified feeling,
inspired by natural language such as English:

>>> send somebody something
>>> send edu-sig@python.org %notes_on_python.txt
>>> send edu-sig@python.org read http://somesite.com/notes_on_python.html

English and almost all human spoken languages are full of oddness, some more
than others. But it is undeniable that a verb like 'send' is pretty
universal idea, regardless of protocol, syntax, etc. Rebol's author Carl
Sassenrath was formerly a bigtime Smalltalk fan and credits a mathematical
theory of 'Denotational Semantics' with playing a role in the design
philosophy underpinning Rebol. I know almost nothing about this yet myself,
but following that thread, you might find some research, theory and metrics
helpful to your Ph.D..

Denotational Semantics
Understand the basic idea of calculating the meaning of a program as some
element of a semantic domain.

The links to papers I find:
http://ase.isu.edu/ase01_07/ase01_07/bookcase/ref_sh/foldoc/9/29.htm
http://www.acm.org/pubs/citations/journals/toplas/1992-14-1/p107-gudeman/
http://www.cogs.susx.ac.uk/lab/nlp/datr/datrnode17.html
http://www.cis.upenn.edu/~bcpierce/types/archives/1991/msg00064.html
http://ptolemy.eecs.berkeley.edu/papers/97/dataflow/
http://www.cs.unc.edu/~stotts/COMP204/assn/densem.html
http://www.cogs.susx.ac.uk/local/teach/spl/list/node3.html
[most are painfully academic to me, ymmv ;-)]

<quote http://www.cs.bham.ac.uk/~mhe/issac/node17.html>
Denotational semantics
On the other hand, from the point of view of the programmer, who, in the
case of real number computation, is typically a mathematician, a physicist
or an engineer, representation details are mostly irrelevant. Whereas the
operational semantics assigns computational mechanisms to program
constructs, the denotational semantics assigns mathematical entities to
them. These entities are real numbers, functions, sequences etc.
</quote>

I have read Python mythology interviews with Guido which refer to ABC and
lessons learned from that. Hopefully there is more in the core Python design
history which could help you too.

hth
Good Luck

- Jason

----- Original Message -----
From: "Jeffrey Elkner" <jeff@elkner.net>
To: <edu-sig@python.org>
Sent: Saturday, September 29, 2001 11:47 AM
Subject: [Edu-sig] measuring python...


> Hi All!
>
> I'm trying to get together a master's thesis and was hoping to do
> something related to Python's suitability as a language for teaching
> programming.  I was thinking of comparing Python, C++, and Java
> solutions to common first year computer science problems in terms of
> length and readability.
>
> Comparing length is not a problem.  "Readability" on the other hand is
> not easy to define in any quantifiable way.  I was thinking of trying
> something like "tokens per line".
>
> Any thoughts?