Python syntax in Lisp and Scheme
Hans Nowak
hans at zephyrfalcon.org
Fri Oct 17 12:35:17 EDT 2003
Jan Rychter wrote:
> I've recently tried to teach someone programming. I thought "Python has
> an easy syntax, let's try that". Well, guess what -- she had a really
> hard time. Inconsistency was a real problem, as was the confusion
> between "statements" and "expressions". When you start programming in
> Python, you get really confused -- does this call have side effects or
> not? You can't tell by looking at the call.
Strange. A beginner shouldn't have a problem with the distinction between
statements and expressions, and shouldn't know about side effects at all, since
this is a notion introduced by functional languages. Does this beginner, by
any chance, come from a functional programming language, or maybe a strong
mathemathical background?
> Also, the syntax was confusing. Yes, indenting the statements is
> easy. But the dot notation is all but obvious, especially with its
> inconsistent application in Python.
How is it inconsistent? It's used to access an object's attributes.
> And where did those square brackets
> suddenly come from and when do I use them?
They're syntactic sugar indicating a "data lookup" of some sorts, hence their
application with dicts and lists.
> Mind you, this is from a beginner's point of view. Most of you look at
> the language syntax from the point of view of a person knowing at least
> one (or more) programming languages and having the basic programming
> concepts drilled in. It's very different for someone who does not have
> that background.
It's possible I guess, different beginners have different ideas, expectations
and experiences, but usually the opposite is true... beginners find Python easy
to use.
> An experiment has shown that Scheme was *much* easier to grasp. In
> Scheme, you can clearly see where side-effects occur and there are less
> syntax rules to follow.
Again, this raises my suspicions that the beginners that were tested have a
mathemathical background. Heck, beginners used Basic for ages... I haven't
heard anyone complain about statements vs expressions, or side effects. They
usually don't even know the distinction.
Cheers,
--
Hans (hans at zephyrfalcon.org)
http://zephyrfalcon.org/
More information about the Python-list
mailing list