Python for Programmers A
Instructor Comment
Hi All. Last week's course was good fun - if a little bit rushed. The source code that we developed together during this first offering of the "Python for Programmers" course is listed below. Syntax aside, my feeling is that probably the most important topic covered was unit testing. Whether you use Python as "yet another scripting language", as a quick way of getting prototypes up and running, as your language of choice or as a wrapper and glue for integration of other codes, I'd very much like to see any interesting codes you develop. If you have any questions, feel free to contact me at darran.edmundson@anu.edu.au.
Source Code
Day 1
- A first script demonstrating string manipulations.
- Use a dictionary to count occurrences of letters.
- Bug fixes to exclude spaces, handle case and pretty print output.
- A first function demonstrating string manipulations.
- Now accepting command-line argument.
- Parsing an ASCII file into a list of lists.
- Rewritten to create a list of dictionaries, one per star.
- Added a function to filter for stars within a circle of given radius.
- OOP problem description and class template.
- Robot class implemented.
Day 2
- A simple Set class.
- Test suite co-developed with the Set class..
- Using os.path module to walk a directory tree.
- Wrapping this up as class, complete with iterator ability.
- Basic use of exceptions.
- Simplest wxPython program, just a empty frame.
- A more complicated window hierarchy, menu bars.
- Chris suggested the wxScrolledMessageDialog, used here in combination with our DirWalker class.
Support Routines and Data Files
Python Programming Resources
- Python home page
- The UseNet group comp.lang.python with 162,000 posts archived on Google.
- The PyUnit unit testing framework (import unittest) now comes as part of Python. Unit testing frameworks are available for many languages and are a big part of the Extreme Programming approach to software development.
- Mark Pilgrim's free online book, Dive Into Python.
- Another good Python intro, How To Think Like A Computer Scientist.
- For Python-based web and server frameworks, there is Webware, the powerful but monolithic Zope, Twisted, the mod_python Apache plug-in, etc.
- For scientists, there is Numerical Python (soon to be superceded by the budding Scientific Python).
- The cross-platform GUI framework we looked at was wxPython.
