To summarize the possible approaches here:

1) Combine multiple with statements into one wherever possible. This seems 
to be the approach of the commit in question.
2) Group with statements based on whether they logically belong together, 
regardless of line length. This will involve backslashes, but note that PEP 
8 specifically blesses this use case: "Long, multiple with-statements 
cannot use implicit continuation, so backslashes are acceptable".
3) Group together logically related with statements unless that would 
involve backslashes, in which case use separate with statements. I think 
this is Marc and Florian's suggestion. The problem here is that the 
grouping of with statements depends on both logical and lexical 
considerations, which seems somewhat less readable to me.
4) Revert the commit and stick with one with statement per line.

Personally, I prefer 4 or 2.

Kevin


On Saturday, September 21, 2013 5:16:04 PM UTC-4, Florian Apolloner wrote:
>
>
>
> On Saturday, September 21, 2013 7:50:34 PM UTC+2, Aymeric Augustin wrote:
>>
>> But whenever the with statement spills over two lines, which happens in a 
>> majority of cases, I find it worse than two with statements. It's 
>> especially bad in the transactions tests — I worked in this area today. 
>>
>
> Agreed; as a groundrule I'd say:
>  * If you need backslashes keep them separate
>  * If one is a test assertion keep them separate
>
> You have a point about consistency, but as long as they are readable I can 
> live with having to versions…
>
> Florian
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to