Hi I wrote two functions which does different manipulations on text files. To start out with I passed the filename as a parameter and each function opened the file and saved it.
I then realized I would need to do that twice if I wanted to use both my functions on the same file. I the modified the functions to take the input as follows: myfunction(open(sys.argv[1]),'ro')) It still wasn't good enough so I modified the function to return data as follows: def myfunction returndata = [] # some code ... return ''.join(returndata) so now I can do myfunction(mysecondfunction(sys.argv[1],'ro')) or mysecondfunction(myfunction(sys.argv[1],'ro')) so my question is philosophical. Is that the pythonian way or is there a better/easier/more efficient way to pass data? To be honest I am still a bit stuck in how I did things when I programmed in Delphi years ago and trying to make the paradigm shift and understanding the data structures. Regards -- Gerhardus Geldenhuis
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
