<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Have you noticed that we have almost 'religious' discussions in the Computer Science community about things some people wouldn't give a hill of beans about? =)<div><br></div><div>I disagree with a fellow BayPIGgier on&nbsp;interpretation&nbsp;of the PEP-8 standard.</div><div><br></div><div>The discussion revolves around code of this nature (obviously a cooked example where it is not necessary to place each attribute of demo on a new line. Comments omitted purposely):</div><div><br></div><div><div>def demo(</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;first_attribute,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;second_attribute</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;):</div><div>&nbsp;&nbsp; &nbsp;print "spam"</div><div><br></div><div>I believe this breaks PEP-8 coding standards (<a href="http://www.python.org/dev/peps/pep-0008/">http://www.python.org/dev/peps/pep-0008/</a>) with regard to "White Space in Expressions and Statements." The guide states "Avoid extraneous whitespace in the following situations...Immediately inside parentheses, brackets or braces."</div><div><br></div><div>However, the argument is that the '\n' character isn't a white space character.</div><div><br></div><div>I feel that it is because of the following:</div><div><br></div><div><div>>>> x='\n';</div><div>>>> print x</div><div><br></div><div><br></div><div>>>> x.isspace()</div><div>True</div><div><br></div><div>And, according to the standard library, we see:</div><div><span class="Apple-style-span" style="font-family: Times; font-size: 16px; "><dt><table cellpadding="0" cellspacing="0"><tbody><tr valign="baseline"><td><nobr><b><tt id="l2h-247" xml:id="l2h-247" class="method" style="font-family: 'lucida typewriter', lucidatypewriter, monospace; ">isspace</tt></b>(</nobr></td><td><var style="font-family: times, serif; font-style: italic; font-weight: normal; "></var>)</td></tr></tbody></table></dt><dd>Return true if there are only whitespace characters in the string and there is at least one character, false otherwise.<p>For 8-bit strings, this method is locale-dependent</p></dd></span></div><div>I also feel that the parenthesis on a new line like this is C-like, artificially creating program blocks when in those days, there was nothing to enforce it. If I were writing C, I may well actually follow the above.&nbsp;</div><div><br></div><div>I also feel that Python enforces this block with indentation, so the artificial construct isn't necessary and is 'anti-pythonic.' The more pythonic approach to me seems:</div><div><br></div><div><br></div><div><div>def demo(first_attribute,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;second_attribute):</div><div>&nbsp;&nbsp; &nbsp;print "spam"</div><div><br></div><div>I could compromise to&nbsp;</div><div><div>def demo(</div><div>&nbsp;&nbsp; &nbsp;first_attribute,</div><div>&nbsp;&nbsp; &nbsp;second_attribute):</div><div>&nbsp;&nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp;print "spam"</div></div></div><div><br></div><div>because this keeps the attributes clearly indented inside the def. However, there is a 'no white space after open parenthesis rule too...</div><div><br></div><div><br></div><div>I am *NOT* looking for arguments where I'm right. I'm looking for arguments where I'm WRONG!!! I want to be very strict ad adhering to industry coding practices and keeping good coding habits on projects I work on. But, if the above *IS* a good coding habit, I'd like to know about it. I want to be argued with.</div><div><br></div><div>The above feels very 'anti-pythonic' to me.... But, I could be wrong... I really like working with this individual, so if I'm wrong, I can still feel I'm following industry standards and code their way with them..</div><div><br></div><div>Please keep in mind that the other person is a bayPIGgier too and someone I respect incredibly... So, flame me if you must... but, not them... We all have different beliefs on things...</div><div><br></div><div><br></div><div><br></div><div>Thanks for all of the help...</div><div><br></div><div><br></div><div>Warmest Regards,</div><div><br></div><div><br></div><div>Glen Jarvis</div></div></div><div><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">415-680-3964</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:glen@glenjarvis.com">glen@glenjarvis.com</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.glenjarvis.com">http://www.glenjarvis.com</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">"You must be the change you wish to see in the world." -M. Gandhi</div><br class="Apple-interchange-newline"></span></div></span> </div><br></div></body></html>