Experiences/guidance on teaching Python as a first programming language

Chris Angelico rosuav at gmail.com
Wed Dec 11 17:04:11 CET 2013


On Thu, Dec 12, 2013 at 2:41 AM, rusi <rustompmody at gmail.com> wrote:
> Yes its always like that:
> When you have to figure 2 (or 10) line programs its a no-brainer that
> the imperative style just works.
>
> When the ten becomes ten-thousand, written by a nut who's left you with
> code whose semantics is dependent on weird dependencies and combinatorial
> paths through the code you start wishing that
>
> - your only dependencies were data dependencies
> - "Explicit is better than implicit" dinned into the nut's head
>
> which BTW are the basic tenets of FP.

And since teaching is seldom done with 10KLOC codebases, functional
style can be left till later. I strongly believe that a career
programmer should learn as many languages and styles as possible, but
most of them can wait. Start with something easy, then pick up
something harder later.

ESR in "How to become a hacker" [1] suggests learning "Python, C/C++,
Java, Perl, and LISP" [2], and do take note of his reasons _why_. I'm
not sure that Perl is so important any more (though a Unix sysadmin
should probably have at least a working knowledge of it, given the
likelihood of tripping over it at some point), and for LISP you might
substitute some other functional language, but broadly, those five
recommendations haven't changed in years and years.

Knowing multiple styles lets you learn from all of them. Pure
functional programming means the result of any function can be
determined entirely from its arguments; that doesn't fit into
everything, but it sure does make your code easier to understand when
you (mostly) stick to it. (For instance, the current logging level
might change whether a particular line does something or does nothing,
but it still fundamentally has the same meaning, and it won't change
state magically anywhere else.) And there's a lot of "similarity of
thinking" between a well-written program in one style and a
well-written program in another style, regardless of which two styles
they are.

ChrisA

[1] http://www.catb.org/esr/faqs/hacker-howto.html
[2] http://www.catb.org/esr/faqs/hacker-howto.html#skills1



More information about the Python-list mailing list