Hrvoje Niksic wrote:

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.

Then why don't you?

In the above example, spaces around the + are not only optional but discouraged, this would be preferred:

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

but if you insist on using spaces (perhaps because it is part of a larger expression) just use parentheses.

func(pos1, pos2, keyword=(foo*spam*ham*eggs + bar/spam**cheese))


Strictly speaking they're not needed, but if they make it easier to read (and I think they do) then why would you not use them?



--
Steven
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to