Python for beginners or not? [was Re: syntax difference]
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Jun 24 07:35:57 EDT 2018
On Sat, 23 Jun 2018 14:52:24 -0500, boB Stepp wrote:
[...]
>> There is a place for various levels of programming language. I'm saying
>> that Python which is always touted as a 'simple' language suitable for
>> beginners, is missing a surprising number of basics.
>
> I still feel like a rank beginner, but on the Tutor list some disagree.
It has been a long, long time since Python has been a "simple" language
suitable for rank beginners, if it ever was. Python is not Scratch.
https://scratch.mit.edu/
Right from version 1.0, Python has included some advanced features, even
mind-blowing features (metaclasses, a.k.a. "the killer joke"). We're now
up to version 3.6 (in production) and 3.7 (in beta) and Python includes
some very advanced modern[1] features, like syntactic support for
asynchronous programming, decorators, generators, coroutines and more.
Better to say that Python is *accessible* to beginners: you can do a lot
of good work in Python using simple constructs and imperative scripts,
and most importantly, the syntax generally doesn't get in your way.
There's relatively little boilterplate needed and a gentle learning curve.
Compare "Hello World" in Java and Python:
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
versus:
print("Hello, World")
The Python example requires the programmer to learn effectively three
things (print, parentheses, strings), compared to over a dozen for Java:
- classes; braces; parentheses; strings; methods;
attribute access using dot; "public" declarations;
"static" declarations; "void" declarations;
type declarations; the existence of System;
System.out; System.out.println; semicolons;
the implicit calling of main.
Aside: there's an extensive, and yet still incomplete, list of Hello
World programs here http://helloworldcollection.de/ with some impressive
examples. Enjoy!
[...]
> As an aside we just had another round of software, OS and hardware
> upgrades. Now I can use Python 2.7!
Yay! Welcome to the 2000s! Hope you will catch up to Python 3 by the
2020s :-)
> Because I read and study about new things as I take them up, I soon
> learned that I had only so far scratched the surface of Python's depths.
> But despite knowing that Python had many more features to explore, both
> in the core language and the standard library, this never hindered me in
> writing my beginner-level programs. I got things done, and I got them
> done fairly easily, and never felt burdened by all the "other stuff"
> that Python had to offer.
Indeed. That's one of the beauties of Python -- even when there's an
advanced way to do it, there's generally a simple way too.
[1] I say "modern", but in fact very little in computer science wasn't
invented by Lisp in the 1950s, or if not Lisp, by CLU in the 1970s.
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson
More information about the Python-list
mailing list