I want to know whether it is a good practice to use yield for file handling,
So currently I use a function f()
f which iterates over a list of file objects and yields the file object.
files = []
for myfile in glob.glob(os.path.join(path, '*.ext')):
    f = open(myfile, 'r')
    files.append(f)
def f():
    for f_obj in files:
        yield f_obj
        f_obj.close()
for f_obj in f():
    // do some processing on file.
Is this a proper way of handling files in Python ?
 
    