classification
Title: math.isclose signature contains incorrect start parameter
Type: Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Shmuel, docs@python, mark.dickinson
Priority: normal Keywords:

Created on 2017-01-30 09:02 by Shmuel, last changed 2017-01-30 20:41 by ammar2. This issue is now closed.

Messages (4)
msg286474 - (view) Author: Shmuel (Shmuel) Date: 2017-01-30 09:02
documentation of math.isclose() signature on https://docs.python.org/3/library/math.html#math.isclose is as follows:

    math.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)

the third star '*' argument is not allowed inside the function: 
https://hg.python.org/cpython/file/tip/Modules/clinic/mathmodule.c.h#l511

or mentioned in PEP485 here: https://www.python.org/dev/peps/pep-0485/#implementation

and does not work when trying provide more than 2 positional values:

>>> import math
>>> math.isclose(1,2,3, rel_tol=5.)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Function takes at most 2 positional arguments (3 given)

So IMHO to solve this remove the positional argument on the signature of isclose() as it misleading.
msg286475 - (view) Author: Shmuel (Shmuel) Date: 2017-01-30 09:03
documentation of math.isclose() signature on https://docs.python.org/3/library/math.html#math.isclose is as follows:

    math.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)

the third star '*' argument is not allowed inside the function: 
https://hg.python.org/cpython/file/tip/Modules/clinic/mathmodule.c.h#l511

or mentioned in PEP485 here: https://www.python.org/dev/peps/pep-0485/#implementation

and does not work when trying provide more than 2 positional values:

>>> import math
>>> math.isclose(1,2,3, rel_tol=5.)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Function takes at most 2 positional arguments (3 given)

So IMHO to solve this remove the positional argument on the signature of isclose() as it misleading.
msg286477 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2017-01-30 09:06
I think you're misreading the signature. The '*' is not a parameter in its own right; it's a piece of syntax marking the end of the positional parameters. Everything following that can only be passed by keyword.  See PEP 3102 for an explanation of the syntax.
msg286478 - (view) Author: Shmuel (Shmuel) Date: 2017-01-30 09:09
ok thanks i think it can be closed
History
Date User Action Args
2017-01-30 20:41:11ammar2setstatus: open -> closed
resolution: not a bug
stage: resolved
2017-01-30 09:09:54Shmuelsetmessages: + msg286478
2017-01-30 09:06:27mark.dickinsonsetnosy: + mark.dickinson
messages: + msg286477
2017-01-30 09:03:45Shmuelsetmessages: + msg286475
2017-01-30 09:02:05Shmuelcreate