[Sugar-devel] Coding style: line continuations
Sascha Silbe
sascha-ml-reply-to-2010-3 at silbe.org
Fri Oct 29 13:48:35 EDT 2010
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.
I'm using four spaces for line continuations because it will
1. decrease the chance of having to split the line several times
2. always look the same
3. make the code easier to read (though that's obviously subjective)
4. work in every editor (none of the editors I've used so far supports
Emacs' continuation style)
(I consider 4. to be of minor importance as it's easy enough to adjust
manually)
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.
Sascha
--
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101029/04d30dbf/attachment.pgp>
More information about the Sugar-devel
mailing list