[MERGE] overhaul RepositoryTestAdapter

Martin Pool mbp at sourcefrog.net
Mon Jul 2 06:35:55 BST 2007


On 7/2/07, Robert Collins <robertc at robertcollins.net> wrote:

> > +        def make_new_test_id():
> > +            new_id = "%s(%s)" % (new_test.id(), scenario[0])
> > +            return lambda: new_id
> > +        new_test.id = make_new_test_id()
> >
> > Why the inner function, rather than just constructing the lambda directly?
>
> So the lambda is bound to a correct new_id each time. IIRC that is - its
> now way outside my short term buffer, but it didn't work without the
> local function when I first created it.

If new_id was inline it would still be evaluated just once per call to
adapt_test_to_scenario, as it is here, unless there is something very
strange happening.  I think you should remove it and see if there's
still a problem, we don't superstitious code hanging around.

-- 
Martin



More information about the bazaar mailing list