ten small Python programs

Steve Howell showell30 at yahoo.com
Sat May 26 22:58:10 EDT 2007


--- Paul McGuire <ptmcg at austin.rr.com> wrote:

> On May 26, 8:48 pm, Steve Howell
> <showel... at yahoo.com> wrote:
> >
> > I'm thinking you could actually have a progression
> > from a 1 line program up to a 50-line program. 
> The
> > number 50 is kind of arbitrary, but my gut says
> that
> > by a 50-line program, you will have demonstrated
> > almost every useful concept.
> >
> 
> If there is anything arbitrary here, I'd say it is
> your "increment
> each example by one source line" constraint.  This
> can force you to
> use some bad coding practices to meet your target
> line count for a
> given example.
>

I understand your point, but I'm sticking to the
concept for now.  My intent with the progression isn't
so much for each example to thoroughly teach a concept
(although I could certainly hyperlink to a more
in-depth treatment), but really more to give a bird's
eye view of the language very quickly.

I recently helped teach a Java programmer to program
in Python, and he learned a lot just by seeing simple
examples.  So I guess my target audience isn't so much
people learning how to program; it's more for
programmers getting their first exposure to Python.

On the other side of the fence, I recently tried to
relearn a bit of Ruby, and I remember being frustrated
by their tutorials, as really, I just wanted to see a
bunch of simple programs, and I can figure out mostly
what they're doing.  Instead, I had to wade through
verbose descriptions of what a variable is, rules for
how you construct identifiers, etc.
 
> Maybe try this approach:  pick your top 10/20/50
> language features and
> develop concise examples. Then order the examples by
> length as a first
> cut (longer examples probably *are* more complex),
> and then reorder a
> bit to handle pre-requisites (introduce a minimum of
> new features,
> preferably 1, per example).  Overall, I'd have a
> tough time picking
> just 10 language features to illustrate, but there
> are probably 10-20
> basic features that will get new people onto fairly
> productive
> ground.  Pick 20 as your example count (50 sounds a
> bit long), and
> stick to it, and then later add "20 More Little
> Programs" for the next
> wave of examples in increasing complexity.
> 

My only reluctance with that approach is that it
sounds like a little more work than I'm ready to take
on right away.  But it's on the Wiki now, so maybe
other folks can help me grow it.

> One other nit to pick: have your example classes
> inherit from object,
> to get new people using new-style classes from the
> get-go.
> 

My only fear here is that when old classes go away
(Py3K? I don't know), that practice may become
obsolete.

But on a more general note, I welcome folks to just
clean up my examples on the Wiki if I accidentally
introduce some bad practices...but preserving line
counts. :)





 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/



More information about the Python-list mailing list