[Baypiggies] Discussion for newbies/beginner night talks

Dennis Reinhardt DennisR at dair.com
Sat Feb 10 18:48:53 CET 2007

At 08:14 AM 2/10/2007, Paul McNett wrote:
> > On Fri, Feb 09, 2007, Dennis Reinhardt wrote:
> >> Stylistically, I often prefer substituting
> >> parameters on a line by line basis because there is better locality, 
> making
> >> the code easier to understand and read.
>How about this contrived example:
>def getHeader(self, **kwargs):
>       ......
>       return html % kwargs

Clever example and manageable.  Not shown is the invocation of getHeader() 
where the actual parameter values are defined.  This contrived example 
separates definition and use.  I think something like

       html += "<title>%s</title>" % ht_obj.param("title")

has better locality by bringing definition and use closer together on same 
line (or two lines).

Synthesizing this discussion,

         title = ht_obj.param("title") #extract string from URL
        html = """\

looks ok to me.  It does not allow piecing together strings conditionally 
at run time but it does a fine job of expressing fixed strings with 
| Dennis    | DennisR at dair.com    |
| Reinhardt | http://www.dair.com |

More information about the Baypiggies mailing list