[Zodb-checkins] CVS: Zope3/lib/python/Persistence/BTrees -BTreeModuleTemplate.c:1.1.2.17

Tres Seaver tseaver@zope.com
10 Jun 2002 10:33:13 -0400


On Mon, 2002-06-10 at 10:05, Tim Peters wrote:
> [Tres Seaver]
> > I started to send you a note about the whine, and then just decided to
> > fix it myself.
> 
> A note would have been fine, but since the compiler I'm using doesn't
> complain in these cases, you do have a better shot at knowing whether a
> putative fix fixes.
> 
> > I even had in mind backporting the patch, but blew my stack on that.
> 
> S'OK:  it went on and off my stack in the wee hours (i.e., I backported it
> already).
> 
> > Macros do make life interesting;  perhaps the sanest thing is just to
> > remove unbracketed 'if' as a prophylactic for the "What do you *mean*
> > indentation isn't significant?" bugs to which Python programmers would
> > be especially prone.
> 
> In my own (private) code I use curlies everywhere they're allowed <wink>.
> That's neither Guido's style nor Jim's, though, and I try to make code blend
> in.

While omitting curlies doesn't strike me as an improvement,  I
don't normally add them to existing code either.

>  But I confess the
> 
> if ()
>   conditional code indented two spaces from block start;
> 
> if ()
>   {
>     conditional code indented four spaces from block start;
>   }
> 
> GNU style drives me plain nuts, and sometimes I've had to reindent functions
> just to "see" what they're doing.

I *loathe* indenting the curlies;  I can stand the "K&R" style (trailing
curly on the line with the block statement), but prefer "Berkeley"
style (curly below block statement, indented at same level).

I had a particular fondness in C++ for them "local curlies to define a
criticial section" idiom, used in conjunction with guard objects whose
destructors released the lock acquired in their constructor;  it would
drive others nuts to see::

  int foo( SomeClass& bar )
  {
      // Some setup here outside the critical section
      {
          Guard guard( bar.getLock() );
          // now in critical section
      }
      // now out of critical section, finish up
  }

Python-means-never-having-to-argue-about-curlies'ly, :)

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com