map is useless!

D'Arcy J.M. Cain darcy at druid.net
Sun Jun 6 20:55:01 EDT 2010


On Mon, 07 Jun 2010 10:16:19 +1000
Lie Ryan <lie.1296 at gmail.com> wrote:
> On 06/07/10 09:56, D'Arcy J.M. Cain wrote:
> > Show me the unit test that defines the problem.
> 
> that you must use foo() and you can't change foo() (since foo is very
> complex), and you give the same result as the original solution.

I reject the artificial restriction.  If foo has a proper unit test I
can refactor it any time I want.  If it doesn't then step one is to add
the missing unit tests.

In any case, the problem should be stated in terms of input and
output.  That's the client requrements.  Enforcing the solution is a
homework assignment, not a real requirements specification.

> def solution(lst):
>     # make changes here only
>     return foo(map, lst)

OK, so I can make changes here.  My change would not use foo.

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list