critique my code, please
gry at ll.mit.edu
gry at ll.mit.edu
Mon Feb 6 13:14:28 EST 2006
Just a few suggestions:
1) use consistant formatting, preferably something like:
http://www.python.org/peps/pep-0008.html
E.g.:
yesno = {0:"No", 1:"Yes", True:"Yes", False:"No"}
2) if (isinstance(self.random_seed,str)):
s=s+"Random Seed: %s\n" % self.random_seed
else:
s=s+"Random Seed: %d\n" % self.random_seed
is unnecessary, since %s handles any type. Just say:
s=s+"Random Seed: %s\n" % self.random_seed
without any if statement.(unless you need fancy numeric formatting).
3) I would strongly discourage using print statements (other than for
debugging) in a GUI program. In my experience, users fire up the GUI
and close (or kill!) the parent tty window, ignoring any dire messages
printed on stdout or stderr. In a GUI app, errors, warnings, any
message
should be in popup dialogs or in a message bar in the main window.
4) If you want to be cute, you can use
s += 'more text'
instead of
s = s + 'more text'
I'm not a wx user so I can't comment on the GUI implementation.
Good luck!
-- George
More information about the Python-list
mailing list