I'm implementing a simple plugin framework for a little Python program and wonder whether there are general best practices for transferring data to plugins?
I'm new to Python and this is what I have come up with so far after doing some reading: I will not use global variables, instead data is going to be passed to the plugin classes on instantiation. At this stage, I see two alternatives.
- pass task-specific data to plugins, don't give plugins access to any other data
- pass all the data to which any plugin should have access
What are the pros and cons of these two alternatives? Are there any other ways or best practices that I am unaware of?
\edit: Any other answers? Do you need more information on what I intend to do? Suggesting generic solutions would be OK as well.