Repository navigation
Closed
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
| BPO | 46882 |
|---|---|
| Nosy | @stevendaprano, @Rotzbua |
| PRs | False instead of 0 #31621 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = None
created_at = <Date 2022-02-28.14:28:31.784>
labels = ['3.7', '3.8', '3.9', 'type-feature', 'docs', '3.10', '3.11', 'library']
title = 'Clarify argument type of platform.platform(aliased, terse) to boolean'
updated_at = <Date 2022-02-28.18:49:58.262>
user = 'https://github.com/Rotzbua'bugs.python.org fields:
activity = <Date 2022-02-28.18:49:58.262>
actor = 'Rotzbua'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'Library (Lib)']
creation = <Date 2022-02-28.14:28:31.784>
creator = 'Rotzbua'
dependencies = []
files = []
hgrepos = []
issue_num = 46882
keywords = ['patch']
message_count = 4.0
messages = ['414198', '414199', '414205', '414213']
nosy_count = 3.0
nosy_names = ['steven.daprano', 'docs@python', 'Rotzbua']
pr_nums = ['31617', '31621']
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue46882'
versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Activity
Rotzbua commentedon Feb 28, 2022
Problem:
Both arguments
aliasedandterseshould be boolean instead of integer.Description:
The function is as
platform.platform(aliased=0, terse=0)so both argumentsaliasedandterseseems 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.
Solution:
Update documentation and set default argument values to
Falseinstead of0.Reference:
Current documentation: https://docs.python.org/3.11/library/platform.html#platform.platform
stevendaprano commentedon Feb 28, 2022
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
TrueandFalseare 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
TrueandFalsebool singletons.stevendaprano commentedon Feb 28, 2022
See bpo-46883
Rotzbua commentedon Feb 28, 2022
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)toplatform(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".
gh-91038: Change default argument value to `False` instead of `0` (#3…
Merge branch 'main' into inlinecomp2