On Saturday, May 17, 2014 2:55:47 AM UTC-7, cboos wrote: > > Hello Ryan, > > On 2014-05-12 5:00 AM, RjOllos wrote: > > I've been wondering if we had a consensus, or could reach one on the > > following very minor coding style issue. When a tuple is returned in a > > "return" or "yield" statement, the parenthesis are optional. In the Trac > > codebase there isn't a consistent pattern of choosing one pattern. I > > tend to prefer the minimal approach of omitting the parenthesis. > > > > Same for me. The valid use for using parentheses in return statements > would be for dealing with line continuations, but other than that for > multiple return values I prefer to be concise and omit them, it simply > looks nicer and more idiomatic. > > You also wouldn't use an explicit tuple here: > > a, b, c = c, b, a > > or here: > > z = [x + y for x, y in pairs] > > And though we're not consistent in the Trac code base, I counted 171 > "return ...," vs. 64 "return (...,". And below my Python/Lib/ the ratio > was even more pronounced towards that style (4/1). > > -- Christian >
Some time ago I added a note to the CodingStyle page, but forgot to followup here: http://trac.edgewall.org/wiki/TracDev/CodingStyle?action=diff&version=18&old_version=17 I like that we aim to be PEP-0008 compliant and prefer idiomatic Python. With regard to the point of people coming from other languages, they should learn idiomatic Python if they'll be Trac contributors, and we'll help them improve their patches to that end ;) -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+unsubscr...@googlegroups.com. To post to this group, send email to trac-dev@googlegroups.com. Visit this group at http://groups.google.com/group/trac-dev. For more options, visit https://groups.google.com/d/optout.