general coding issues - coding style...

plahey at alumni.caltech.edu plahey at alumni.caltech.edu
Sat Feb 18 18:29:05 EST 2006


Hi,

1585 if sys.path[0][-12:] == "\library.zip":  #for py2exe

how about

if sys.path[0].endswith( "\\library.zip" ):

(did you really mean one back-slash there?)


499     tuple = os.path.split(filename)

bad variable name... tuple(x) converts a sequence to a tuple.


You have a number of places where you check for len(x)==0:

674     if len(files) == 0:
853     if len(file_show) == 0:
950     if len(imgprocess["files_todo"]) == 0:

people usually recommend:

if not files:
if not file_show:
if not imgprocess["files_todo"]:


you should run your code through pychecker (it had a lot to say...).


You use global alot... that should be a red flag.  Like the poster
above mentioned,  you have things that are telling you they want to
be objects.


The #{{{ and #}}} stuff is very annoying to other programmers
(ok, to me...).  You might want to investigate a Python aware
editor (like SPE, which has pychecker built in).  This is
coming from someone who uses vim regularly.




More information about the Python-list mailing list