[Tutor] constructing semi-arbitrary functions
Steven D'Aprano
steve at pearwood.info
Mon Feb 17 22:22:56 CET 2014
On Mon, Feb 17, 2014 at 07:58:00PM +0000, Oscar Benjamin wrote:
> The "right" solution is to change the interface of the third party
> function. It is poorly designed and should not be inspecting those function
> attributes or it should at least provide an option for you to provide that
> information in a different way. Assuming it's open source you could try
> sending a patch. In the mean time you could copy that code and modify it to
> suit your purposes.
This may be a good case for some of the Design Patterns so popular in
the Java world.
I think what you want is an Adaptor:
http://en.wikipedia.org/wiki/Adapter_pattern
only written for a function rather than a class.
--
Steven
More information about the Tutor
mailing list