[Tutor] associating two objects without ORM and processing a text file
Steven D'Aprano
steve at pearwood.info
Tue Feb 12 23:56:56 CET 2013
On 13/02/13 04:32, neubyr wrote:
> I am not following your comment on opening books file twice in
> list_by_author method. I have opened it only once and then reading each
> line while checking for a regex match. Am I missing something?
You open the catalog file once to read the books in the first place.
Then when you want a list of books by author Fred, you open the catalog
file, even though all the books are (somewhere) in memory.
Then when you want a list of books by author Bob, you open the catalog
file again. Then when you want a list of books by Sally, you open the
catalog file yet again. And so on.
--
Steven
More information about the Tutor
mailing list