[Baypiggies] [Fwd: Re: Discussion for newbies/beginner night talks]
Michael Bernstein
webmaven at cox.net
Sat Feb 10 06:05:43 CET 2007
On Fri, 2007-02-09 at 17:21 -0800, Dennis Reinhardt wrote:
> At 05:05 PM 2/9/2007, Paul McNett wrote:
>
> >I respectfully disagree. Take this example:
> >
> >class MyBizobj(...):
> > def getCustomerInfo(self, cust_id):
> > sql = """
> >select customers.name as name,
>
> This starts with an empty line. I believe this can be changed by
>
> sql = \
> """select customers.name as name,
>
> Which then breaks up the SQL, albeit only slightly.
I recently came across some code that used this convention:
a = StringIO("""\
blah blah blah
...
""")
which takes care of the leading extra line.
Or, I found this useful function a couple of years ago that strips the
leading and trailing blank lines and eliminates the *common* extra
indentation at the beginning of lines in a multiline string, so you
could add the extra whitespace needed to make it look OK within the code
without sacrificing the indenting that was actually part of the string's
formatting:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/145672
HTH,
- Michael R. Bernstein
michaelbernstein.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/baypiggies/attachments/20070209/274636b0/attachment.pgp
More information about the Baypiggies
mailing list