[Tutor] looking for some general advice
Alan Gauld
alan.gauld at btinternet.com
Sun Jun 10 19:32:54 CEST 2007
Michael,
That's a fairly big project for a first timer, its obvious that you
are new to Python rather than to programming. It looks
pretty good to be honest, the main things I'd flag are:
1) Best to be specific in your except clauses. Generic
catch-anything type clauses can lead to misleading error
messages. They are OKmat the top level of a program for
distribution as a way of shielding innocent users from stack
traces but during development and especially inside your
code its better to catch specific exceptions.
2) Rather than putting the exception name in quotes
"IndexError" just leave the quotes off and raise/catch the
error class directly.
3) argv = sys.argv
Doesn't really achieve much, you might as well just use sys.argv,
it's not much extra typing! nit-picking...
4) For completeness you could avoid the os.system call to
wget and implement it as a Python function using the ftplib
library... (But to be honest wget is a lot easier!) Or maybe
use the new subprocess module instead of os.system.
You might also want to check that wget executed successfully.
Othewise I don't see too much to complain about.
Well done, a good first program.
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list