[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-08 Thread Thomas Fischbacher
Thomas Fischbacher added the comment: Re AlexWaygood: If these PEP-484 related things were so obvious that they would admit a compact description of the problem in 2-3 lines, these issues would likely have been identified much earlier. We would not be seeing them now, given that Python by

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-08 Thread Alex Waygood
Alex Waygood added the comment: Please try to make your messages more concise. -- ___ Python tracker ___ ___ Python-bugs-list

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-08 Thread Thomas Fischbacher
Thomas Fischbacher added the comment: This is not a partial duplicate of https://bugs.python.org/issue47121 about math.isfinite(). The problem there is about a specific function on which the documentation may be off - I'll comment separately on that. The problem here is: There is a

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-06 Thread Ken Jin
Change by Ken Jin : -- nosy: -kj ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-06 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-06 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is a partial duplicate of an issue you already filed: https://bugs.python.org/issue47121 where math.isfinite(10**1000) raises an OverflowError even though it type checks. Here was one of the comments: """ Types relationships are useful for verifying

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-05 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: Thanks for your report, but I would appreciate a more concise explanation. Let me try to rephrase the problem. Given this function: def mean(x: list[float]) -> float: return sum(x) / len(x) We want to provide a guarantee that if x is a nonempty list

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-05 Thread Thomas Fischbacher
New submission from Thomas Fischbacher : Here is a major general problem with python-static-typing as it is described by PEP-484: The approach described in https://peps.python.org/pep-0484/#the-numeric-tower negatively impacts our ability to reason about the behavior of code with stringency. I