[Python-ideas] Boolean parameters guidelines

Eric V. Smith eric at trueblade.com
Sun May 8 09:08:58 EDT 2016


On 5/8/2016 8:14 AM, Nick Coghlan wrote:
...

> 2. If the boolean toggle is expected to be constant for any given
> call-site, consider defining two different functions (e.g.
> statistics.variance vs statistics.pvariance)

Wouldn't that be "for every (or almost every) call-site"? Surely a few
constants here and there are okay, it's when parameters are constants
almost everywhere that the guidance comes in to play.

> The reason I think this is worth documenting is that it comes up
> regularly in PEPs that require some associated API design, and these
> are the rules of thumb we generally apply.

Agreed.

Eric.



More information about the Python-ideas mailing list