Dice gen and analyser script for RPGs: comments sought

Steven Bethard steven.bethard at gmail.com
Wed Sep 13 15:18:45 EDT 2006


George Sakkis wrote:
> * [personal preference]: Don't leave space between *every* operator in
> expressions, group them based on precedence. E.g. instead of "(n *
> sigmaSq - sigma * sigma) / (n * n)", I read it easier as "(n*sigmaSq -
> sigma*sigma) / (n*n).

The spaced-out version is more `PEP 8`_ compliant.  Under "Whitespace in 
Expressions and Statements -> Other Recommendations" it says "Use spaces 
around arithmetic operators" and gives a few examples of "Yes" usage 
that look much like the OP's usage.

That said, I also tend to omit the spaces around multiplicative 
operators (though I'm slowly training myself out of that).  As you say, 
in the end, this is really a matter of personal preference.

.. _PEP 8: http://www.python.org/dev/peps/pep-0008/


STeVe



More information about the Python-list mailing list