Re: [Tutor] reading lines from a list of files

2015-05-14 Thread Alan Gauld
On 14/05/15 06:27, Alex Kleider wrote: The following seems to work- for f_name in list_of_file_names: for line in open(f_name, 'r'): process(line) but should I be worried that the file doesn't get explicitly closed? If you are only ever reading from the file then n

Re: [Tutor] reading lines from a list of files

2015-05-14 Thread Alex Kleider
On 2015-05-14 00:15, Laura Creighton wrote: In a message of Wed, 13 May 2015 22:27:11 -0700, Alex Kleider writes: As a follow up question: The following seems to work- for f_name in list_of_file_names: for line in open(f_name, 'r'): process(line) but should I be worried

Re: [Tutor] reading lines from a list of files

2015-05-14 Thread Alex Kleider
On 2015-05-14 00:01, Alan Gauld wrote: On 14/05/15 06:27, Alex Kleider wrote: The following seems to work- for f_name in list_of_file_names: for line in open(f_name, 'r'): process(line) but should I be worried that the file doesn't get explicitly closed? If you ar

Re: [Tutor] reading lines from a list of files

2015-05-14 Thread Alex Kleider
On 2015-05-13 23:24, Danny Yoo wrote: As a follow up question: The following seems to work- for f_name in list_of_file_names: for line in open(f_name, 'r'): process(line) but should I be worried that the file doesn't get explicitly closed? It depends on context. Pers

Re: [Tutor] reading lines from a list of files

2015-05-14 Thread Laura Creighton
In a message of Wed, 13 May 2015 22:27:11 -0700, Alex Kleider writes: >As a follow up question: >The following seems to work- > > for f_name in list_of_file_names: > for line in open(f_name, 'r'): > process(line) > >but should I be worried that the file doesn't get explicitl

[Tutor] Terminology question

2015-05-14 Thread Jim Mooney Py3.4.3winXP
I noticed that if I call a function that throws an error, I can catch it from the caller, instead of catching it in the function. Is this is what is known as "errors bubbling up?" Also, is this how you're supposed to do it? *** Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600

Re: [Tutor] Terminology question

2015-05-14 Thread Alan Gauld
On 14/05/15 23:43, Jim Mooney Py3.4.3winXP wrote: I noticed that if I call a function that throws an error, I can catch it from the caller, instead of catching it in the function. Is this is what is known as "errors bubbling up?" Yes. They can bubble up naturally because there are no handlers l

Re: [Tutor] Terminology question

2015-05-14 Thread Ben Finney
"Jim Mooney Py3.4.3winXP" writes: > I noticed that if I call a function that throws an error (Known in Python as “raise an exception”. I understood you, but it's better to use the terminology that matches what the Python docs say.) > I can catch it from the caller, instead of catching it in the