[Python-Dev] Suggested addition to PEP 8 for context managers

Hrvoje Niksic hrvoje.niksic at avl.com
Wed Apr 18 09:31:51 CEST 2012


On 04/17/2012 04:21 PM, Guido van Rossum wrote:
> I hope that's now what it says about slices -- that was meant for dict
> displays. For slices it should be symmetrical. In this case I would
> remove the spaces around the +, but it's okay to add spaces around the
> : too. It does look odd to have an operator that binds tighter (the +)
> surrounded by spaces while the operator that binds less tight (:) is
> not.

The same oddity occurs with expressions in kwargs calls:

func(pos1, pos2, keyword=foo + bar)

I find myself wanting to add parentheses arround the + to make the code 
clearer.


More information about the Python-Dev mailing list