Hey, guys! I'm a bit stuck at problem set 5, problem 11 where we need to write a function that reads in a file containing information about what triggers with what names should be created.
I may overcomplicate this but I'm not sure what the output should be. A dictionary of trigger names as keys, maybe, with the content stored as corresponding values? Any ideas?
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
Problem 11. Finish implementing readTriggerConfig(filename). We’ve written code to open the file and throw away all the lines that don’t begin with instructions (e.g. comments, blank spaces). Your job is to finish the implementation. readTriggerConfig should return the list of triggers specified in the configuration file.
"return the list of triggers specified in the configuration file"
Yeah, but I mean what does that mean? What is a trigger? I can create a list of lists where each element is a trigger's representation (name, type, arguments) but I hardly think that solves the problem.
An idea is that the function should "create" (with assignment) triggers that have the specified names and can be used outside the functions scope. But that seems just way too complicated. So what am I missing? :)
well the docstring for the function that they partially wrote for us says that it returns a list of trigger objects. if you look at the initial main_thread() function they wrote for us, you can see that it is supposed to be a list
Not the answer you are looking for? Search for more explanations.
Okay, yes, I overcomplicated it, creating and enlisting Trigger objects does not require any magical name assignments. Thanks for the help :) The code works now, although, it's pretty annoying that I don't know how to stop the thread (the one that gathers RSS feeds) once it has started... Other than by quitting IDLE.
ctrl-c seems to work but the docs say it may not - http://dpaste.com/909558/
for the newsreader; I tried ctrl-c to get the shell prompt back then thread.exit() - that does not work