[Sugar-devel] Coding style: line continuations

Martin Dengler martin at martindengler.com
Fri Nov 12 04:38:26 EST 2010


On Thu, Nov 11, 2010 at 05:39:50PM +0100, Sascha Silbe wrote:
> Excerpts from Sugar Labs Bugs's message of Wed Oct 27 11:11:49 UTC 2010:
> 
> >  {{{
> >  249                 self._shared_activity.connect('buddy-joined',
> >  250                     self._buddy_joined_cb)
> >  }}}
> >  In emacs I just use tab for that, the next line then gets aligned under
> >  the buddy joined. Same below:
> >  {{{
> >  290             logger.debug('Tube address: %s', \
> >  291
> >  self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].GetDBusTubeAddress(id))
> >  }}}
> 
> We should agree on a continuation style, otherwise we'll confuse new
> contributors.

Agreed - but like your example, anyone who's using "\" inside
parentheses is almost certainly already confused.

> In cases where using four spaces would make the code harder to read
> because the block following it uses the same indentation width I add
> four more spaces (i.e. eight total):
> 
> if (really_really_long_variable_name > another_long_variable_name and
>         long_variable_name[another_long_variable_name] == 'bar'):
>     print "whatever"
> 
> 
> I applied this style for the clean-up patch series.

That style can be questioned, but even I can't be bothered to quibble
on such a point, so I agree with you; want if you haven't already
documented it that way, I will.

> Sascha

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101112/0c670242/attachment-0001.pgp>


More information about the Sugar-devel mailing list