You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarify argument type of platform.platform(aliased, terse) to boolean #91038
Problem:
Both arguments aliased and terse should be boolean instead of integer.
Description:
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.
Solution:
Update documentation and set default argument values to False instead of 0.
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.
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