Req. comments on "first version" ch 2 progr. intro (using Python 3.x in Windows)
Alf P. Steinbach
alfps at start.no
Mon Nov 9 18:22:36 CET 2009
* Jon Clements:
> On Nov 9, 4:10 pm, "Alf P. Steinbach" <al... at start.no> wrote:
>> Chapter 2 "Basic Concepts" is about 0.666 completed and 30 pages so far.
>> It's now Python 3.x, and reworked with lots of graphical examples and more
>> explanatory text, plus limited in scope to Basic Concepts (which I previously
>> just had as a first ch 2 section -- but there's rather a lot of concepts!).
>> I think it's wise to invite comments even when it's not 100% completed. First,
>> because as opposed to ch 1 there is quite a bit of code here, and since I'm a
>> Python newbie I may be using non-idiomatic constructs, not to mention doing
>> worse things. :-) Second, because comments in general can improve the text.
>> 2.1 Super-basic concept: why programming is not DWIM. 1
>> 2.2 Reported errors. 4
>> 2.2.1 Case-sensitity. 4
>> 2.2.2 Syntax / compilation errors. 4
>> 2.2.3 Runtime errors / crashes. 5
>> 2.3 A programming exploration tool: turtle graphics. 6
>> 2.4 Naming things. 8
>> 2.4.1 Naming actions: routines. 8
>> 2.4.2 Naming data part I: variables. 11
>> 2.4.3 Naming data part II: routine arguments. 13
>> 2.5 Controlling the flow of execution. 14
>> 2.5.1 Repeating actions automatically: loops. 14
>> 2.5.2 Basic comparisions & boolean values. 16
>> 2.5.3 Interlude I: a function graph program / about types. 17
>> 2.5.4 Automated action choices. 21
>> 2.5.5 Value-producing (function-like) routines. 23
>> 2.5.6 Interlude II: a graph with zeroes marked / about program structure. 26
>> 2.5.7 Dynamically nested actions: recursive routines. 28
>> 2.6 Objects. [Not started on this] 31
>> 2.7 Collections. [Not started on this] 31
>> In Google Docs (both chapters available here):
>> Formats: PDF
>> - Alf
> Well, you may not like it, but it is perfectly acceptable and indeed
> promoted to use CONSTANT_VAR_NAMES. You're almost discouraging the use
> of a well understood and oft-used idiom. I they're a lot of them, you
> generally have a settings module, that just lists all of the
> 'constants' (.h files effectively).
Yeah, I thought of that angle so I emphasized 'programs'.
As it happens about half or more of the variables in the examples are constants.
All uppercase convention for that would be ugly to me. :-)
> "Technically line_length is a variable"...: No - it's a name that
> binds to an object that happens to be an integer. You've participated
> in discussions re: this. Similarly 'number_of_apples =
> number_of_apples + 1' is not an assignment ;)
Ah, you're kidding.
Anyways, that's the terminology employed by the language reference, and even if
it wasn't I'd use it because this is primarily introduction to programming in
general, where Python just happens to be the vehicle; thus, language independent
terminology preferred (e.g., I use "routine" instead of C/Python "function").
> It's nit-picky and I
> realise you're trying to keep it simple, but as it's meant for new
> programmers to the Python language, then introduce them to Python's
> way of "variables", they'll thank you for it later... (or run
> screaming, or start another thread here...)
Yeah, good point, thanks!
But it will have to wait till I get down into details... ;-)
> I've never seen/heard != described as "different from"; what's wrong
> with "not equal to"?
> And why no mention of 'not' (should be mentioned
> with booleans surely?).
Again, I'll discuss that later. It's just too much to bring up. Most of my work
with this has been to pare down to essentials and *remove* stuff I'd written.
> That's as far as I've got; might get around to reading more later...
> Cool tree at the end :)
More information about the Python-list