On Wednesday 20 May 2009 13:54:56 David Stanek wrote: > On Wed, May 20, 2009 at 7:13 AM, Doug Hellmann <doug.hellm...@gmail.com> wrote: > > On May 19, 2009, at 10:21 PM, David Stanek wrote: > >> It seems that using a technique similar to dependency injection could > >> provide some value. DI allows implementations conforming to some > >> interface to be injected into a running application without the messy > >> construction logic. The simple construction-by-hand pattern is to > >> create the dependencies and pass them into the dependent objects. > >> Frameworks build on top of this to allow the dependencies to be wired > >> together without having any construction logic in code, like switch > >> statements, to do the wiring. > >> > >> I think a similar pattern could be used in the standard library. When > >> the interpreter goes through its normal bootstrapping process in can > >> just execute a module provided by the vendor that specifies the > >> platform specific implementations. Some defaults can be provided since > >> Python already has a bunch of platform specific implementations. > >> > >> An over simplified design to make this happen may look like: > >> 1. Create a simple configuration that allows a mapping of interfaces > >> to implementations. This is where the vendor would say when using > >> inspect you really should be using cli.inspect. > > > > That sounds like a plugin and the "strategy" pattern. Tarek is doing > > some work on providing a standard plugin mechanism as part of the work > > he's doing on distutils, isn't he? > > Basically yes. What I proposed is more like a service locator with a > pinch of DI. Where can I learn more about what Tarek is working on? Is > there a branch somewhere?
it is here: http://wiki.python.org/moin/Distutils/PluginSystem and there: http://pypi.python.org/pypi/extensions cheers, sebastien. -- ######################################### # Dr. Sebastien Binet # Laboratoire de l'Accelerateur Lineaire # Universite Paris-Sud XI # Batiment 200 # 91898 Orsay ######################################### _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com