Why not allow empty code blocks?

Rustom Mody rustompmody at gmail.com
Wed Aug 3 07:48:38 EDT 2016


On Wednesday, August 3, 2016 at 1:57:43 PM UTC+5:30, Antoon Pardon wrote:
> Op 02-08-16 om 14:29 schreef Rustom Mody:
> > So I was talking of 3 very different levels:
> >
> > 1. print x vs print(x)
> > — a difference too petty for me to waste my time with
> >
> > 2. Procedure vs Function as something very necessary for beginner
> > thinking-ontology which Pascal gets right
> >
> > 3. The fact that the gap between a mainly-for-teaching language and a serious
> > software-engineering-real-world language is not closable
> > And that saying that the same language could be used for both purposes is
> > like arguing that both these delightful ladies are pianists:
> >
> >
> > Martha: https://www.youtube.com/watch?v=YLZLp6AcAi4
> > Rose : https://www.youtube.com/watch?v=_bjKDJD-CLc
> >
> >
> > Scheme and Pascal happen to be two well-known well-crafted but quite different
> > for-teaching languages
> 
> But on what ground is scheme a well-crafted for-teaching language?
> 
> It is not because it gets the Procedure vs Function ontology right.
> 
> As far as I know scheme has about the same data structures as python,
> they are just called differently and there are some limitations.

Technically you are right
But “technically” is not the most important facet.
So yes scheme are python have similar underbellies but the culture of use
is quite different.
eg The very first example in the python tutorial uses a print statement/expr.
Whereas in scheme you can go through much of the text(s) before you see the same

Note: You CAN use python scheme-ishly but few people do that.
eg here is SICP in python with the first examples pure useful powerful functions:
http://www-inst.eecs.berkeley.edu/~cs61a/sp12/book/functions.html#first-example

So people can use python functionally but somehow have the idea that imperative
is easier/more natural/what-have-you

Scheme and python data structures:
Python has a rich COLLECTION of data structures
Scheme really has just one — S-exp

Software-engineering-wise this conduces to power in python and headache/nuisance
in scheme
But for a learner its the opposite:
You do say dir([]) or dir({}) and you get a whole truckload of methods — how many
to learn??
With scheme you chew up car/cdr/cons until you reach an epiphany of understanding

vide Bruce Lee's quote: I am not afraid of the man who has practised ten 
thousand kicks. I am afraid of the man who has practised one kick ten thousand
times

Then there are motley little things that make python beginner-unfriendly.
Noob makes a file whose name masks a builtin module and random things stop working. Umpteen such examples keep appearing out here. All point to one direction: Guido wants his language to be lightweight and for serious software
engineering.
Sure the ‘lightweight’ conduces to a neater language for teaching than say
C++, Java etc.  But the teaching/learning is not the primary goal, its software
engineering.

This can be seen in many sundry choices
Backward compatibility: Guido is chary about introducing new keywords since
code that currently uses that will break unexpectedly.  And so we get new features 
that are seemingly clever but actually rather infelicitous; eg 
- conditional expression with wrong order of arguments
- def overloaded for (ordinary) function and generator
- yield overloaded for coroutine and generator

For a beginner backward compatibility is a meaningless requirement:
If python-2016 is inconsistently different from python-2015 who is affected
since the bunch of learners has moved on.
[Hapless teacher excepted!]

Scheme — especially Dr. Scheme/racket — embraces inconsistency by offering
different ‘teachpacks’ — different language syntaxes/semantics' for learners
at different levels

Likewise platform independence:
One important goal of (core) python is that unless you go out of your way to
be troublesome, a python program (script) on linux will run on windows and vice-
versa (eg. universal newlines)
This is of course good
The flip-side is that important functionality that cant be easily supported
— eg GUIs — get relegated to ‘advanced’ topics which is a euphemism for get
neglected
[As a thought experiment: If we started by teaching VB would GUIs look as 
advanced as they do in python?]

Once again like backward compatibility, platform independence is meaningless 
to a beginner: For the one system that (s)he uses/owns it works or doesn’t work.
That it may or may not work for other invisible, unimaginable systems is
wildly over-the-top philosophy.

OTOH racket (scheme) comes with fairly comprehensive GUI/graphics functionality
[not tried myself]
I expect
1. Its not really in the professional league of Qt or Wx but its enough for
a beginner to have a comprehensive experience
2. An experience which is likely perceived as easier than struggling with
PyQt wxPython etc



More information about the Python-list mailing list