ten small Python programs

Paul McGuire ptmcg at austin.rr.com
Sat May 26 22:13:46 EDT 2007


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.

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.

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

-- Paul




More information about the Python-list mailing list