[Python-Dev] Proposal for Python 3.3: dependence injection

Andrew McNabb amcnabb at mcnabbs.org
Thu Mar 24 18:46:42 CET 2011


On Thu, Mar 24, 2011 at 10:12:18AM -0700, Guido van Rossum wrote:
> On Thu, Mar 24, 2011 at 9:46 AM, Benjamin Peterson <benjamin at python.org> wrote:
> >> I want to test the dev community interest in modifying the stdlib to
> >> ease dependence injection.
> >
> > I, for one, am -1. Code shouldn't be uglified for the purposes of
> > testing.
> 
> Well, the philosophy of dependency injection requires exactly that.
> Personally I am on the fence; I've seen is used effectively but I've
> also seen code, indeed, uglified with little benefits. (Same for other
> extreme testing practices like TDD.)

I agree with the comments about uglification, but testing was only one
of the use cases that Jesus provided.  He also mentioned using
alternative network implementations, integrating with event loops, etc.
Another use case that I've run into before is setting socket options.

--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868


More information about the Python-Dev mailing list