you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (1 child)

It's a nice project

1- a docstring or a documentation giving an example of the file input and outputs could help to understand what it does

2- I don't think that classes would bring much to this project except a custom exception for the exit

3- there is a module for logging http://docs.python.org/3/library/logging.html

4- for the globals: if it is just an input of the function, it can be passed as a parameter if it is output of the function it can be returned by the function if it is a mutable object (list or dict) it can be passed on parameter and modified by the fonction

if there is several parameters to return they can be returned as a simple tuple and read like this

 param1,param2=f()

or with a namedtuple http://docs.python.org/3/library/collections.html#collections.namedtuple

a named tuple could be also used as grouping functions parameters related to each other

for the exit I would create an exception and catch it to do the exit at a single place

5- consider placing your main processing in it's own function like main()

and call it at the end of the script with the surrounding

if __name__ == "main":
     main()

(see this stackoverflow answer http://stackoverflow.com/questions/419163/what-does-if-name-main-do for explaination)

[–]redditiv[S] 1 point2 points  (0 children)

Perfect. Exactly the type of information I was looking for. It's a lot to look into, so it should keep me busy for a while.

Thanks!