[New-bugs-announce] [issue36492] Deprecate passing some conflicting arguments by keyword

Serhiy Storchaka report at bugs.python.org
Sun Mar 31 03:17:26 EDT 2019


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

As Steve mentioned in the discussion about PEP 570 [1], some changes of parameters to positional-only are breaking (although there is no breaks in the stdlib code). Before making parameters positional-only we should add a deprecation warning for passing them as keyword arguments. Similarly to the code used in the UserDict constructor (see issue22609).

The following PR adds deprecation warnings for other parameters which should be positional-only. It also fixes bugs about nonavailability to pass special keyword names like "self" or "func". Just one example:

>>> import functools
>>> def f(self, func): pass
... 
>>> functools.partialmethod(f, func=chr)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'func'


[1] https://discuss.python.org/t/pep-570-python-positional-only-parameters/1078/53

----------
components: Library (Lib)
messages: 339249
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Deprecate passing some conflicting arguments by keyword
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36492>
_______________________________________


More information about the New-bugs-announce mailing list