This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Clarify argument type of platform.platform(aliased, terse) to boolean
Type: enhancement Stage: patch review
Components: Documentation, Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Rotzbua, docs@python, steven.daprano
Priority: normal Keywords: patch

Created on 2022-02-28 14:28 by Rotzbua, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31617 open Rotzbua, 2022-02-28 14:30
PR 31621 open Rotzbua, 2022-02-28 18:33
Messages (4)
msg414198 - (view) Author: (Rotzbua) * Date: 2022-02-28 14:28
Both arguments `aliased` and `terse` should be boolean instead of integer.

The function is as `platform.platform(aliased=0, terse=0)` so both arguments `aliased` and `terse` seems to be numbers.
The documentation says: "If aliased is true,[..]" which gives a hint that the type should be boolean instead of an integer.
Looking into the implementation both arguments used as boolean.

Update documentation and set default argument values to `False` instead of `0`.

Current documentation:
msg414199 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2022-02-28 14:49
> Both arguments `aliased` and `terse` should be boolean instead of integer.

Why should they be strictly True/False booleans? I disagree strongly that they should be. Any object that duck-types as a true or false value is sufficient.

Treated as a documentation change, your PR is wrong because it implies that *only* the singletons `True` and `False` are acceptable, when in fact any true and false (note the lowercase) values are acceptable.

Personally, I prefer the terms "truthy" and "falsey", or "a true value" and "a false value" over a bare true/false, but some people do not, and it is a long-standing tradition in Python circles to understand lowercase true/false as the duck-typed values as opposed to the `True` and `False` bool singletons.
msg414205 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2022-02-28 15:20
See #46883
msg414213 - (view) Author: (Rotzbua) * Date: 2022-02-28 18:49
Thanks for pointing out the logical change from "true" to "True".
I do not want to start a discussion about principles.

Nevertheless I think a change from `platform(aliased=0, terse=0)` to `platform(aliased=False, terse=False)` makes the how-to-use more intuitive.

The change does not change any function behavior or breaks any backwards compatibilities.

I created a new PR without the change of "true".
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 91038
2022-02-28 18:49:58Rotzbuasetmessages: + msg414213
2022-02-28 18:33:36Rotzbuasetpull_requests: + pull_request29745
2022-02-28 15:20:05steven.dapranosetmessages: + msg414205
2022-02-28 14:49:34steven.dapranosetnosy: + steven.daprano
messages: + msg414199
2022-02-28 14:30:28Rotzbuasetkeywords: + patch
stage: patch review
pull_requests: + pull_request29742
2022-02-28 14:28:31Rotzbuacreate