<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#330033" bgcolor="#ffffff">
<tt>On 6/2/2011 11:19 AM, Barry Warsaw wrote:</tt>
<blockquote cite="mid:20110602141900.7cd024c0@neurotica.wooz.org"
type="cite">
<pre wrap=""><tt>On Jun 02, 2011, at 08:09 PM, guido.van.rossum wrote:
</tt></pre>
<blockquote type="cite">
<pre wrap=""><tt>+ Continuation lines should align wrapped elements either vertically using
+ Python's implicit line joining inside parentheses, brackets and braces,
+ or using a hanging indent of double your code indention, in which case
+ there should be no argument on the first line. For example:
+
+ Yes: # Aligned with opening delimiter
+ foo = long_function_name(var_one, var_two,
+ var_three, var_four)
+
+ # Double code indention for hanging indent; nothing on first line
+ foo = long_function_name(
+ var_one, var_two, var_three,
+ var_four)
+
+ No: # Stuff on first line forbidden
+ foo = long_function_name(var_one, var_two,
+ var_three, var_four)
+
+ # 2-space hanging indent forbidden
+ foo = long_function_name(
+ var_one, var_two, var_three,
+ var_four)
</tt></pre>
</blockquote>
<pre wrap=""><tt>
As I mentioned to Guido, I'm not sure where the double-indent recommendation
comes from, but it's entirely possible I missed that discussion. I agree with
the recommendations, but think a single-indentation level looks fine. E.g.
return dict(
fqdn_listname=member.mailing_list,
address=member.address.email,
role=role,
user=path_to('users/{0}'.format(member.user.user_id)),
self_link=path_to('members/{0}'.format(member.member_id)),
)
or
return b'{0}://{1}:{2}/{3}/{4}'.format(
('https' if as_boolean(config.webservice.use_https) else 'http'),
config.webservice.hostname,
config.webservice.port,
config.webservice.api_version,
(resource[1:] if resource.startswith('/') else resource),
)
-Barry
</tt></pre>
</blockquote>
<tt><br>
One place a double indent is extremely nice is for lines that
initiate a new indentation, but are themselves continued:<br>
<br>
if some_function(<br>
Some,<br>
Parameters,<br>
To,<br>
Pass,<br>
)<br>
If_True_Operations()<br>
<br>
is much more readable than:<br>
<br>
</tt><tt>if some_function(<br>
Some,<br>
Parameters,<br>
To,<br>
Pass,<br>
)<br>
If_True_Operations()<br>
<br>
</tt><br>
<tt><br>
</tt>
</body>
</html>