Rhodri James wrote:
On Thu, 24 Sep 2009 21:11:36 +0100, Brown, Rodrick <rodrick.br...@citi.com> wrote:

I recently started playing with Python about 3 days now (Ex Perl guy) and wanted some input on style and structure of what I'm doing before I really start picking up some bad habits here is a simple test tool I wrote to validate home dirs on my system.

Ethan's made some good points.  Here are a couple more.

[snip]
try:
  fh = open(filename)
except IOError:
  print "No such filename: %s" % (filename)
[snip]

It's is usually a bad idea to loose information when giving feedback to the user.
try:
 fh = open(filename)
except IOError, exception:
 print "Error openning %s : " % (filename, exception)

In general, if you want to improve your coding style/rules, read PEP 8 and this page :
http://tottinge.blogsome.com/meaningfulnames/

This is a must read (yet you still can disagree).
Regarding this,
fh = open(filename) would become
fileHandler = open(fileName)

Much nicer to read :o)

These are just suggestions, cheers.

JM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to