On Mon, Mar 7, 2011 at 1:44 PM, Anthony Liguori <anth...@codemonkey.ws> wrote: > On 03/07/2011 07:27 AM, Stefan Hajnoczi wrote: >> >> On Mon, Mar 7, 2011 at 1:22 AM, Anthony Liguori<aligu...@us.ibm.com> >> wrote: >> >>> >>> +def print_definition(name, required, optional, retval): >>> >> >> This function is pretty long. Is there a logical way to split it up >> into several smaller meaningful functions? >> > > It seems long because of the code generation but there's really not an awful > lot of logic in it. > > It might be worth spending a little time looking at a template system. I'm > not terribly familiar with any of the popular ones and I think they usually > focus on HTML generation but it might help readability.
There's a really simple one built into Python: http://docs.python.org/release/2.5.4/lib/node40.html Stefan