* Alf P. Steinbach:
* Alf P. Steinbach:
Format: PDF
<url: http://preview.tinyurl.com/ProgrammingBookP3>
The new stuff, section 2.7, is about programs as simulations and
handling data, focusing on modeling things. It includes some Python
GUI programming. The plan is to discuss containers like lists and
dictionaries in perhaps two more subsections of 2.7, but I'm not quite
sure about how to approach that or exactly how much to cover, since
the intent of ch 2 is to introduce mostly general concepts and enable
the reader to try out (more or less) interesting things.
Cheers,
- Alf
PS: comments welcome!
Well, I posted the current doc. It has a not yet quite complete section
2.7.7 about arrays, and that will be the last subsection of the
chapter. I thought using the Josephus circle problem as example was
pretty neat... :-)
But anyway, comments welcome, even if that last section's not yet finished.
Well, what's a programming introduction without Lena Söderberg and Blaise Pascal
-- the beauty & the beast? :-)
So I added them. Examples with some Sierpinsky triangles (from Pascal's
triangle) and simple photo processing (of Lena). With Lena, Josephus and Blaise
in the examples it's almost like the Good, the Bad and the Ugly...
Comments very welcome.
Especially, from the Python community, I'm pretty sure that there must be more
Pythonic ways of copying things like my Matrix in section 2.7.7, or conventions
established for that. Although Python details aren't essential -- since this
is about programming and so far only about concepts, notwithstanding the photo
processing not yet delving into actually technical stuff -- it would be Bad to
teach very inferior ways of using the language. So, Better Ways (considering
that I've endavoured to introduce only a minimal subset of the language in order
to teach concepts cleanly!) would be good!
Current contents listing below (it's now also as PDF on Google Docs).
Cheers,
- Alf
Contents:
1 Getting started ... 1
1.1 Python variants, implementations and distributions. 1
1.2 Download and install a Python implementation. 2
1.3 Test-drive the Python interpreter. 2
1.4 Create and run a Python console program. 4
1.5 Syntax highlighting and programmers’ editors. 6
1.6 Create and run a Python GUI program. 7
1.7 About compilation. 9
1.8 About standalone Windows programs & other kinds. 10
1.9 Browse the local documentation. 11
– EOT – ... 12
2 Basic concepts ... 1
2.1 Super-basic concept: why programming is not DWIM. 1
2.2 Reported errors. 4
2.2.1 Case-sensitivity. 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 Basic data. 36
2.6.1 Basic fundamental types / strings & concatenation. 36
2.6.2 Indexing and single characters (+ vaguely about sequences in general). 39
2.6.3 Interlude III: a ROT-13 encryption/decryption program, refactoring. 40
2.6.4 Attributes, methods, objects. 43
2.6.5 Doc strings. 44
2.6.6 Interlude IV: attribute names as strings, listing str attributes. 45
2.6.7 References & automatic garbage collection. 46
2.7 Programs as simulations / handling data. 51
2.7.1 Real system, model, user illusion. 51
2.7.2 Scopes – global versus local variables. 53
2.7.3 Attribute collections & models with accessor and modifier routines. 57
2.7.4 Defining your own data types: classes. 63
2.7.5 Using optional and named actual arguments (Python “keyword” arguments). 68
2.7.6 Interlude V: a GUI light switch simulation (+ about delegates and MVC). 71
2.7.7 Indexable collections (arrays). 84
– EOT – ... 98
--
http://mail.python.org/mailman/listinfo/python-list