Hi Norm,
As George said, the trick in this case is to use the =:noweb= and =:noweb-ref= headers. The change is minimal from the script you sent:
#+TITLE: Python literate programming
#+OPTIONS: html-postamble:nil
It starts off as a completely standard Python3 program.
#+BEGIN_SRC python :tangle yes :weave no
#!/usr/bin/env python3
#+END_SRC
It defines ~a~.
#+BEGIN_SRC python :tangle yes
def a():
print("a")
#+END_SRC
And ~b~.
#+BEGIN_SRC python :tangle yes
def b():
print("b")
#+END_SRC
Now ~c~ is a little more complicated:
#+BEGIN_SRC python :tangle yes :noweb no-export
def c():
print("c")
<<call-a-and-b>>
#+END_SRC
Not only does ~c~ print “c”, it calls ~a()~ and ~b()~.
#+BEGIN_SRC python :tangle no :noweb-ref call-a-and-b
b()
a()
#+END_SRC
Finally, make it importable. Not that you’d want to.
#+BEGIN_SRC python :tangle yes
if __name__ == "__main__":
main()
#+END_SRC
Note the =:noweb no-export= in the block that contains =def c()=. The =no-export= value makes it so that, on HTML export, the noweb reference is shown as a reference instead of expanded (which is usually what you want). The next block is given its name using the =:noweb-ref= header argument. You could also use =#+name:= - the main difference is that =:noweb-ref= allows you to have multiple blocks with the same name, which are concatenated together when tangled, whereas =#+name:= only allows one block with the same name.
If I may do a bit of self-promotion, feel free to check out my "Literate Config" booklet, which I published just a few days ago (available for free) and which contains some more tips for doing literate programming:
https://leanpub.com/lit-config/read
Best,
--Diego