My son wants me to teach him Python

J

John Ladasky

Hi folks,

My son is 17 years old. He just took a one-year course in web page design at his high school. HTML is worth knowing, I suppose, and I think he has also done a little Javascript. He has expressed an interest in eventually wanting to program 3D video games.

For that purpose, HTML and Javascript are too limited. I hardly consider either one to be a real programming language. I want to get him started with a real applications programming language -- Python, of course. And he's ready to learn. OK, so it's not necessarily a fast enough language for theepic video games he envisions, but it's a darn good start. I'll tax his brain with a compiled language like C at some other time.

He's a smart kid, but prefers to be shown, to be tutored, rather than having the patience to sit down and RTFM. Have any of you been down this road before? I would appreciate it if you would share your experiences, or provide resource material.

Thanks!
 
C

Chris Angelico

He's a smart kid, but prefers to be shown, to be tutored, rather than having the patience to sit down and RTFM. Have any of you been down this road before? I would appreciate it if you would share your experiences, or provide resource material.

Actually yes! My dad (whose name is also John) asked me the same
question, regarding one of my siblings. I put the question to the
list, and got back a number of excellent and most useful answers
regarding book recommendations, and we ended up going with (if memory
serves me) Think Python [1]. It seems to be doing fine, though I've
overheard some issues regarding Tkinter, Python 3.3, and Debian
Squeeze. So be aware that you may have to compile your own Python, and
if you do, you may have to look at what modules get compiled in. But
from my experience of building Python, that's not difficult.

[1] http://www.greenteapress.com/thinkpython/ I think, but DNS on this
computer is broken at the moment so I can't verify that link

ChrisA
 
C

Chris Angelico

There is a google course in python on videos. I believe it has time outs
for doing assignments. Here is where you go to get started
https://developers.google.com/edu/python/

Went digging to see what version they support, and found it - buried -
and with some FUD:

https://developers.google.com/edu/python/set-up
"For Google's Python Class, you want a python version that is 2.4 or
later, and avoiding the 3.x versions for now is probably best."

I would recommend going with Python 3, preferably 3.3, because that's
the future of Python. Unless you have a good reason for sticking with
2.x, go with 3.x.

ChrisA
 
J

John Ladasky

Unless you have a good reason for sticking with 2.x, go with 3.x.

I agree, Chris, I will be teaching my son Python 3 from the start. In fact, I'm in the middle of a messy upgrade of my own computer to get everythingready for Python 3. Upgrading my son's machine should be less painful, because he doesn't need cutting-edge versions of scipy, wxPython or Matplotlib... but I do hope that some of the game packages, like PyGame, are Python 3-compatible. I haven't checked into that yet.
 
I

Ian Kelly

I agree, Chris, I will be teaching my son Python 3 from the start. In fact, I'm in the middle of a messy upgrade of my own computer to get everything ready for Python 3. Upgrading my son's machine should be less painful, because he doesn't need cutting-edge versions of scipy, wxPython or Matplotlib... but I do hope that some of the game packages, like PyGame, are Python 3-compatible. I haven't checked into that yet.

I've used pygame with Python 3, so it's definitely compatible.
 
C

Chris Angelico

Went digging to see what version they support, and found it - buried -
and with some FUD:

https://developers.google.com/edu/python/set-up
"For Google's Python Class, you want a python version that is 2.4 or
later, and avoiding the 3.x versions for now is probably best."

I would recommend going with Python 3, preferably 3.3, because that's
the future of Python. Unless you have a good reason for sticking with
2.x, go with 3.x.

BTW, just to clarify this statement: I don't object to there being
courses for 2.x that don't touch 3.x (though I'd still use this as a
strong criterion in choosing a course); the bit I object to is the
vague FUD about "avoiding" 3.x, as though that branch isn't stable
yet. If it simply said "For Google's Python Class, you want a Python
version between 2.4 and 2.7.x", that'd be much better.

ChrisA
 
R

Rick Johnson

[...]
He's a smart kid, but prefers to be shown, to be tutored,
rather than having the patience to sit down and RTFM.
Have any of you been down this road before? I would
appreciate it if you would share your experiences, or
provide resource material.

Hello John.

I'm going to suggest a completely different path to enlightenment for the lad. A path that has the potential for semi-instant gratification whilst also humbling the boy to the grim realities of computer graphics and application development. *evil grin*

Since your son has zero experience with both graphical and application based programming i would suggest starting at (near) the very bottom of the GUIspectrum, which, in the Python world would be the Tkinter Canvas.

Some people would suggest starting with "turtle.py", and yes this is a goodsuggestion, however, i highly suggest that he begin by coding a python turtle program HIMSELF.

But first i would let him use the existing turtle program, play around withit, understand some of the commands, etc... but whatever you do: DON'T LETHIM SEE THE SOURCE CODE! Then i would ask him to think about how this program works in a general manner (psst: remember, he's not a programmer "yet"!).

For starters we know we need to create a "window" (this is where you would explain what a GUI library is. And to satisfy the instant gratification, weshould create a window very soon.

After we can create a blank window, we should take this opportunity to quickly cover some of the common subwidgets that can be placed into a window, such as:: "Text", "Entry", "Label", "Button", etc.., and maybe some simple code to display each of them will be fun.

Now that we know "generally" what a GUI is, and we know about windows and sub-widgets, it's time to refocus on the turtle program. We will need to create a drawing area within the window for which to draw the turtle -- enter the Tk::Canvas!

Next we can take a slight tangential meandering and learn about common Canvas primitives (like rectangles and lines and whatever!) Then we should decide which primitive would best suit a turtle, and draw that primitive.

Once we have drawn the turtle, we quickly realize that it needs to sprout some legs and move around. This is where the fun really starts to begin... Ithink you can figure out where to go from there. Math functions, event processing... fun times!

After he gets a simple turtle program running i would point out that even though he went to quite bit of work to solve this fairly simple problem, most of the really difficult code, like turning pixels on and off, drawing andordering GUI windows, event loops, etc, etc... has been abstracted away into multiple layers of low level code. Even though the starting point of our project could be considered "slightly low level" relative to Python, there are vast libraries of millions of lines of code, layered one atop the other, making all this possible.

The point of this exercise would be to get him thinking about solving problems instead of just reaching for a prepackaged library, and then not fully appreciating (or furthermore, truly *understanding*) the vast scope of *real* software design.

Anybody can grab PyGame and start making simple games, but do they understand what is going on under the hood? I don't think they need to understand the science behind the internal combustion engine, however, if they cannot explain the basics of how the major components like: electrical, fuel, suspension, drive-train, braking, etc... work, then they lack a fundamental insight into solving complex problems that can arise later.

For instance, if you hear a knocking sound whilst driving but the sound is absent whist idling, you can deduce that the problem most likely exists in the drive-train. From there you'd need to focus in at an even smaller levelof detail -- but you could not come to that conclusion if you did not possess (at minimum) a basic understanding of the underlying component systems.

Of course some might say: "Rick, why go to all that trouble when you couldtraumatize him with openGL instead". And to that i would reply: "Save OpenGL for lesson number two!"

*wink*
 
C

Chris Angelico

[...]
He's a smart kid, but prefers to be shown, to be tutored,
rather than having the patience to sit down and RTFM.
Have any of you been down this road before? I would
appreciate it if you would share your experiences, or
provide resource material.

Hello John.

I'm going to suggest a completely different path to enlightenment for the lad. A path that has the potential for semi-instant gratification whilst also humbling the boy to the grim realities of computer graphics and application development. *evil grin*

Since your son has zero experience with both graphical and application based programming i would suggest starting at (near) the very bottom of the GUI spectrum, which, in the Python world would be the Tkinter Canvas.


No. Definitely not. Programming does NOT begin with a GUI. It begins
with something *simple*, so you're not stuck fiddling around with the
unnecessary. On today's computers, that usually means console I/O
(actually console output, with console input coming along much later).

ChrisA
 
R

Rick Johnson

No. Definitely not. Programming does NOT begin with a GUI. It begins
with something *simple*, so you're not stuck fiddling around with the
unnecessary. On today's computers, that usually means console I/O
(actually console output, with console input coming along much later).

Chris, you're a dinosaur, only thing is, somebody forgot to tell you.

*Everything* these days revolves around graphical interfaces. The console, which was once the dark and mystical battlefield where knighted geeks would slay the plagues of exception demons, has been reduced to a mere: "little black box of nostalgia".

1. Rock is dead...
2. The console is dead...
3. Welcome to the 21st century Chris!

PS: Although i'll bet you think the "rock is dead" mantra is relatively recent, nope! Jim Morrison was singing about it waaay back in 1969!
 
C

Chris Angelico

Chris, you're a dinosaur, only thing is, somebody forgot to tell you.

*Everything* these days revolves around graphical interfaces. The console, which was once the dark and mystical battlefield where knighted geeks would slay the plagues of exception demons, has been reduced to a mere: "little black box of nostalgia".

1. Rock is dead...
2. The console is dead...
3. Welcome to the 21st century Chris!

PS: Although i'll bet you think the "rock is dead" mantra is relatively recent, nope! Jim Morrison was singing about it waaay back in 1969!

1. Rock is not dead, remove the covering paper and you'll find it's
happily smashed scissors.

2. The console is healthy. It's often now seen alongside a GUI, with
neither being by any means dead. And "glass teletype" is still the
easiest UI to program for in any language.

3. Thanks! I've been here for a while, but it's still nice to be made welcome.

ChrisA
 
A

Andrew Berg

1. Rock is dead...
Nah, he just does movies now.

Seriously, though, GUI stuff might be okay to learn early on since he's interested in making games. There's no reason to focus heavily on it
this early, however.
 
E

Ethan Furman

If he wants to learn game programming, teach him game programming. [. . .]

Oh, that reminds me:

http://inventwithpython.com/

Which has a number of free books; the two of interest for your son being:

Invent Your Own Computer Games with Python

Making Games with Python & Pygame

Both are for Python 3.x.
 
C

Chris Angelico

Also Chris has an "unnatural" abhorrence of Python 2.7 :) --- at least as
far as learning Python books.

Thanks for hunting that thread down, I probably should have back when
I mentioned it :)

As to my abhorrence of Py2 - I don't hate the language (and do use it
at times), but if someone's going to learn programming, s/he should
really learn from something with native Unicode strings. Yes, you
could use Python 2 and open with some future directives, but unless
the course/book is written with that in mind, you'll end up having to
unlearn and relearn to master true Unicode handling. No point doing
that when you can just learn on Python 3!

ChrisA
 
R

rusi

Hi folks,

My son is 17 years old.  He just took a one-year course in web page design at his high school.  HTML is worth knowing, I suppose, and I think hehas also done a little Javascript.  He has expressed an interest in eventually wanting to program 3D video games.

For that purpose, HTML and Javascript are too limited.  I hardly consider either one to be a real programming language.  I want to get him started with a real applications programming language -- Python, of course.  And he's ready to learn.  OK, so it's not necessarily a fast enough language for the epic video games he envisions, but it's a darn good start.  I'll tax his brain with a compiled language like C at some other time.

He's a smart kid, but prefers to be shown, to be tutored, rather than having the patience to sit down and RTFM.  Have any of you been down this road before?  I would appreciate it if you would share your experiences, orprovide resource material.

Thanks!

Some views of mine (controversial!).

Python is at least two things, a language and a culture.
As a language its exceptionally dogma-neutral.
You can do OO or FP, throwaway one-off scripts or long-term system
building etc

However as a culture it seems to prefer the OO style to the FP style.
This is unfortunate given that OO is on the down and FP is on a rise.
Some thoughts re OOP: http://blog.languager.org/2012/07/we-dont-need-no-ooooo-orientation-4.html

So my suggestion is use some rigorous FPL like Haskell to learn/teach
programming.
After that you can switch to python or some other realistic language.

Note: I have some serious reservations regarding Haskell
http://blog.languager.org/2012/08/functional-programming-philosophical.html
Nevertheless it seems to be the best there is at the moment.

tl;dr: Haskell is in 2013 what Pascal was in 1970 -- good for
programming pedagogy.
 
R

Roy Smith

rusi said:
Python is at least two things, a language and a culture.

This is true of all languages. Hang out on the PHP, Ruby, Python, etc,
forums and you quickly learn that the cultures are as different (or more
so) than the languages.

The same is true for the human race. The human race is what it is
partly because of the DNA we mix-and-match every generation, but also
because of the information we pass from brain to brain. Neither one
tells the full story of what we are.
 
R

rusi

This is true of all languages.  Hang out on the PHP, Ruby, Python, etc,
forums and you quickly learn that the cultures are as different (or more
so) than the languages.

Umm... Of course. I dont know though how that relates to the OP's
question.
So let me try state my point differently:

Python-the-language has strengths that are undermined by the biases in
the culture of Python.
A father wanting to give his son the best may want to apply correcting
anti-biases.
 
T

Tomasz Rola

Hi folks,

My son is 17 years old.  He just took a one-year course in web page
design at his high school.  HTML is worth knowing, I suppose, and I
think he has also done a little Javascript.  He has expressed an
interest in eventually wanting to program 3D video games.
[...]

Some views of mine (controversial!).

Not really :)
Python is at least two things, a language and a culture.
As a language its exceptionally dogma-neutral.
You can do OO or FP, throwaway one-off scripts or long-term system
building etc

However as a culture it seems to prefer the OO style to the FP style.
This is unfortunate given that OO is on the down and FP is on a rise.
Some thoughts re OOP: http://blog.languager.org/2012/07/we-dont-need-no-ooooo-orientation-4.html

So my suggestion is use some rigorous FPL like Haskell to learn/teach
programming.
After that you can switch to python or some other realistic language.

If he (son) learns Haskell, he may as well stay with it, because it's
quite decent lang as far as I can tell. And it's compiled, too.

I would also consider Racket, which is a Scheme superset. It too, comes
with compiler/JIT, plus IDE, plus libraries plus I understand examples
from "Structure and Interpretation of Computer Programs",
( http://mitpress.mit.edu/sicp/ ) can be run on it. I have heard some
folks are doing real life stuff with it, too and IDE might help beginner a
lot (this one is very nice, not just magnified editor).
Note: I have some serious reservations regarding Haskell
http://blog.languager.org/2012/08/functional-programming-philosophical.html
Nevertheless it seems to be the best there is at the moment.

Mee too! For this reason I am exploring Ocaml and SML.

Regards,
Tomasz Rola

--
** A C programmer asked whether computer had Buddha's nature. **
** As the answer, master did "rm -rif" on the programmer's home **
** directory. And then the C programmer became enlightened... **
** **
** Tomasz Rola mailto:[email protected] **
 
M

Mark Janssen

Despite not want to RTFM as you say, you might set him in front of
VPython, type

I totally forgot PyGame -- another likely source of self-motivated
learning for a teen programmer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,742
Latest member
AshliMayer

Latest Threads

Top