ANN: HB - Learn Python A Little Faster
tundra at tundraware.com
Sat Jul 14 02:50:02 EDT 2001
Learning a new language always comes to me in two parts:
Learn the pieces - Syntax, Semantics, mechanics - i.e., Read tutorials.
Put it all together - Learn the idioms, see a complete application,
understand the rationale for design decisions and so on.
I have completed an application written completely in Python. Although
the application itself is very unremarkable (a budget management system),
it is certainly not a trivial or toy program. It's just big enough
to be interesting.
I wanted to make it available to others learning Python along with
the requisite documentation to see how all the parts fit together.
So, I went back and documented the thing and commented it heavily.
You'll find it at: http://www.tundraware.com/Software/HB/HB.tar.gz
IMPORTANT NOTE: This is not intended to "teach" you Python or
programming or anything else. The idea is that you already know how
to program and have a basic understanding of how Python does things.
The point here is to "Put It All Together" and show an application of
all the pieces as an integrated whole.
This is a pretty straighforward Budget Management system. Nothing too
esoteric here, really:
Unlimited Different Budgets
Up to the limit of your disk space.
Well, the limit is what you can squeeze on a single screen.
Limited by memory - if you run out of UnDo stack,
you're using HB for WAY too complicated budgets ;)
Prints Reports To Printer (Win32 Only) Or Disk File (All OS)
Handles Monthly "Burn Rate" For Each Account
Pay, Debit, Credit, And Transfer Funds
Balance The Budget
Read And Write Budget Files
This is probably what you really care about:
Uses Every Major Python Data Structure
Tuples, Tuples Of Tuples, Tuples Of Tuples Of Tuples, Lists,
Dictionaries, and Objects
Has Mixture Of OO And Procedural Code
Python is *really* good at this.
Uses A Regular Expression For Input Validation
Uses 'eval' To Demonstrate Runtime String Execution
(Some) Exception Handling
Disk, Keyboard, And Device I/O
Code Is Completely "UnStrung"
There are no literals (other than newlines) embedded in the code
which makes maintenance and internationalization very simple.
Completely Table-Driven Command Interpreter
Kinda cool, actually. A little complicated at first, but it makes
adding new features a snap AND prepares the way for mating the program
to a GUI if you must have one in your life.
Stack-Based Context Management And UnDo Facilities
LOADED With Explanatory Comments So You Understand What's Going On
Caveats And Acknowledgements
I am an experienced programmer, but not an experienced *Python*
programmer. This means that not everything in HB is necessarily good
Python - I hope it is, it probably mostly is, but it probably also has
some warts. If you *are* an experienced "Pythonista" and you see
something in HB that makes you just wince, send me an email and let me
know what needs fixin'.
I also want to take a moment and thank the many friendly people of
comp.lang.python who answer my many stupid questions promptly and
correctly both on the newsgroup and privately.
Also, a big "Thank You" to http://www.diveintopython.org for one of the best
language tutorials I've ever seen. It is a work-in-progress, but a
"must" if you are learning Python.
Finally, a huge thanks to GVR and the many people who designed,
implemented, and refine one of the slickest programming languages
tundra at tundraware.com
More information about the Python-list