> ---------- Messaggio inoltrato ---------- > From: "Alan Gauld" <alan.ga...@btinternet.com> > To: tu...@python.org > Subject: Re: [Tutor] Tutor Digest, Vol 61, Issue 3 > > OK, To do that you need to provide an intrerface in your code > that the plug-in can use. That is to say you must call a documented > set of functions/methods and then arrange your code such that the > plugin can replace the default code.
Thank you Alan, that's what I wanted :) I've understood the idea, and I'll investigate it. The only doubt I have is how to adapt it to multiple plugins related to the same interface. Let's say my program downloads a file from a url and saves it in a local directory. One plugin could be written to add a prefix to the file name and another one to make the filename all-caps. In this case the same interface (let's call it "ManageFileName") should be used twice (or, in general, many times), and it's not simple to decide a priori how to merge the two actions. This lets me think about decorators, is that a possibility? Each user could write it's own decorator to the "setFileName()" method and the program will use them together. As I don't know decorators in python at all, I'm not sure this could work out, but it could be a nice push to start learning :) _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor