It looks like you want the :epilogue header argument. See inline.

> On Apr 22, 2019, at 2:00 AM, Dmitrii Korobeinikov <dim12...@gmail.com> wrote:
> 
> When I write several source blocks, which depend on one another, I tend to 
> debug them one by one.
> 
> So, I write this function and test it:
> 
> #+NAME: square
> #+BEGIN_SRC python
>     square = lambda x: x * x
>     return square(5)
> #+END_SRC
> 
> #+RESULTS: square
> : 25
> 


Equivalently, you could run this:

#+NAME: square
#+BEGIN_SRC python :epilogue  return square(5)
    square = lambda x: x * x
#+END_SRC



> After I see that the test is successful, I write this client function:
> 
> #+BEGIN_SRC python :noweb yes
>     <<square>>
>     return 5 + square(5)
> #+END_SRC
> 
> #+RESULTS:
> : 25
> 
> And here, to get the correct result, I have to remove the ~return square(5)~ 
> line in ~<<square>>~.
> But I don't want to lose testing!
> S

With my version of `square`, the epilogue is not included. 

So it works as you want it to.

HTH,

Chuck



Reply via email to