[issue47031] math.nan should note that NANs do not compare equal to anything
Charlie Zhao added the comment: I started a PR and some simple examples were added. It is helpful for those who are new to IEEE-754. According to Jelle's comments, the behavior of `float('nan') is float('nan')` may be changed in the future, so I just omit it and suggest users to use `math.isnan()`. This might make the documentation a bit clearer. -- ___ Python tracker <https://bugs.python.org/issue47031> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47031] math.nan should note that NANs do not compare equal to anything
Change by Charlie Zhao : -- keywords: +patch pull_requests: +30248 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32170 ___ Python tracker <https://bugs.python.org/issue47031> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47031] math.nan should note that NANs do not compare equal to anything
Charlie Zhao added the comment: > "Due to the requirements of the `IEEE-754 standard > <https://en.wikipedia.org/wiki/IEEE_754>`_, math.nan and float('nan') are > never equal to any other value, including themselves. Use math.isnan to test > for NANs." It seems to me, Steven's description is clear enough to tell us that "Be careful if you want to compare NANs with others". One thing to emphasize is that neither `is` nor `==` is a best practice, just like slateny's example, we should be wary of the difference between `float('nan')` and `math.nan`. Adding an example to the docs would be a good way to let everyone know the difference and use `math.isnan` instead of `is` and `==` to test for NANs. -- nosy: +CharlieZhao ___ Python tracker <https://bugs.python.org/issue47031> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46677] TypedDict docs are incomplete
Change by Charlie Zhao : -- pull_requests: +29913 pull_request: https://github.com/python/cpython/pull/31815 ___ Python tracker <https://bugs.python.org/issue46677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46677] TypedDict docs are incomplete
Change by Charlie Zhao : -- pull_requests: +29907 stage: backport needed -> patch review pull_request: https://github.com/python/cpython/pull/31808 ___ Python tracker <https://bugs.python.org/issue46677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46677] TypedDict docs are incomplete
Change by Charlie Zhao : -- keywords: +patch pull_requests: +29498 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31349 ___ Python tracker <https://bugs.python.org/issue46677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46677] TypedDict docs are incomplete
Charlie Zhao added the comment: Indeed, if you use Python keywords or other invalid Python names as keys of TypedDict, we must use the equivalent forms as follows: ``` Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'in': str}) # OK Point2D = TypedDict('Point2D', x=int, y=int, in=str) # Error ``` Maybe we should add this to the docs. And, it seems that adding examples for inheritance and attributes of TypedDict would make the docs clearer. Would you mind if I submit a PR for those changes. :) -- nosy: +CharlieZhao ___ Python tracker <https://bugs.python.org/issue46677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45735] Promise the long-time truth that `args=list` works
Change by Charlie Zhao : -- pull_requests: +29161 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/30982 ___ Python tracker <https://bugs.python.org/issue45735> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com