Your impression of for-novice writings on assertions

Steve Holden steve at holdenweb.com
Wed Feb 3 02:06:49 CET 2010


Alf P. Steinbach wrote:
> I've started on ch 3 of my beginner's intro to programming, now delving
> into the details of the Python language.
> 
> It's just a few pages yet, file [03 asd.pdf] (no real title yet!) at
> <url: http://tinyurl.com/programmingbookP3> which is at Google Docs.
> 
> The first topic is about assertions and exceptions. I wonder whether
> this text is easy or difficult to understand for a beginner. Or any
> improvements that could be made.
> 
I don't think it's helpful in Python to refer to "... variables, which
are named locations in memory, ..." because Python specifically eschews
this model, and trying to explain assignment (especially of mutable
objects) in those terms will lead to conceptual difficulties.

Also, why introduce exceptions by talking about "error handling" when
the term "exception handling" is hanging in the air? This is also a
conceptual thing, since you want to get the reader used to the idea that
it's a legitimate programming technique to use exceptions as part of
their programs' normal control flow.

I'd also recommend taking docstrings a little more seriously, since
their use makes code much more self-documenting - someone can import
your module and learn its API using the help() function. You may have
done that in an earlier chapter.

Just a few points for you to think about, and reject if you choose.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC                 http://www.holdenweb.com/
UPCOMING EVENTS:        http://holdenweb.eventbrite.com/




More information about the Python-list mailing list