Lee Cullens wrote:
> Pythonese/Efficiency/Generalese critique please
> 
> I'm new to Python and as an exercise created a little utility module.  
> I'm learning from the O'Reilly books and updating that understanding 
> from the 2.4 documentation.  
> 
> I would appreciate any comments you see fit to offer.

I find the nested functions confusing myself; is there a reason they are 
nested? If they can stand alone I would make them separate top-level functions 
with names starting with _ to indicate that they are private.

    dlst = os.listdir(pname)
    if len(dlst):
      for dlf in dlst:

There is no need for the if(dlst); if the list is empty the iteration will do 
nothing. You can write this as
    for dlf in os.listdir(pname):

Some blank lines would aid readability. For example before each comment in 
cellpos() and before each elif in the main conditional block.

Do you know there is a csv module that helps to read and write csv files? It 
will take care of escaping " in your filenames, if such a thing is possible...

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to