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

Guido van Rossum guido at python.org
Thu Mar 24 18:12:18 CET 2011


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.)

> It's also a slippery slope. Maybe we should add parameters
> for open() and io functions? What about sys and os? Those often need
> to be mocked.

There are existing solutions that work pretty well, so I'm thinking
there is no big problem that this solved.

But my main concern is about anything that proposed to make sweeping
changes to a large number of stdlib modules. This has almost always
resulted in reduced quality.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list