msg288802 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-02 14:54 |
Proposed patches deprecate the "x" keyword parameter in int(), bool() and float() and the "sequence" keyword parameter in list() and tuple(). Name "x" is meaningless, and name "sequence" is misleading (any iterable is accepted, not just sequence). The documentation uses name "iterable" for list() and tuple().
It is never documented that any of these parameters are accepted by keywords. There was only a test for int(), but it was added just for increasing coverity, not to test intended behavior. Does this mean that the support of keyword arguments can be removed without deprecation?
The general idea got preliminary approval from Guido (https://mail.python.org/pipermail/python-ideas/2017-March/044959.html).
|
msg288803 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2017-03-02 14:59 |
I don't think we should do it without deprecation, since it could break working code. But it certainly sounds like a marginal case: I doubt there is *much* code that uses the existing keyword names.
|
msg288804 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-03-02 15:09 |
R. David Murray added the comment:
> I don't think we should do it without deprecation, since it could break working code. But it certainly sounds like a marginal case: I doubt there is *much* code that uses the existing keyword names.
I'm not sure that it's worth it to add a deprecation warning in Python
3.7. It's trivial to fix code passing an argument by keyword rather
than by position.
|
msg288805 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-02 15:12 |
Well, I was feeling the same, but asked just for the case.
Could you then look at deprecation messages? I'm sure that 'The "x" keyword argument of int() is deprecated' is not the best wording, and may be even ugly wording. Could you please suggest better wording David?
Patches don't document new deprecations because it is not documented that keyword arguments are supported either. Is mentioning in What's New enough?
|
msg288806 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-03-02 15:22 |
"What's New in Python 3.7" has a section for such changes: "Porting to
Python 3.7: Changes to the Python API".
https://docs.python.org/dev/whatsnew/3.7.html#porting-to-python-3-7
Oh, I see that you already made a similar change but this one had a
deprecation period of 2 releases (3.5 and 3.6): "A format string
argument for string.Formatter.format() is now positional-only."
See also the positional-only arguments discussion on python-ideas:
* https://mail.python.org/pipermail/python-ideas/2017-February/044879.html
* https://mail.python.org/pipermail/python-ideas/2017-March/044956.html
|
msg288808 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2017-03-02 15:37 |
So these will become positional only? In that case I'd say "Using 'x' as a keyword argument is deprecated; specify the value as a positional argument instead"
|
msg288809 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-02 15:42 |
See also issue20283. Obviously wrong keyword parameter names in regex methods were deprecated in 2.7, 3.3 and 3.4 and removed in 3.6.
|
msg288811 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-02 16:05 |
Thank you David! Updated warning messages for your suggestion and added entries in Misc/NEWS and What's New.
|
msg289052 - (view) |
Author: Raymond Hettinger (rhettinger) * |
Date: 2017-03-05 23:32 |
I concur with Victor and Serhiy that we can bypass a deprecation phase here and just get it done. In the rare case of int(x=3.14), the fix is trivial.
|
msg289067 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-06 06:54 |
I already merged the patch as 58d23e68068996c76cac78887ec67dee68cdbc72.
If you think that it would be better to remove without deprecation, the following patch does this.
|
msg289068 - (view) |
Author: Raymond Hettinger (rhettinger) * |
Date: 2017-03-06 07:04 |
I do think it would be better to not have the deprecation.
|
msg289105 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-03-06 14:24 |
> If you think that it would be better to remove without deprecation, the following patch does this.
@Serhiy: Can you please create a PR for it?
|
msg289107 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-06 14:34 |
If David agrees with this.
|
msg289110 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2017-03-06 14:50 |
If Raymond is on the side of skipping the deprecation than I'm good with it. Like I said, this is a marginal case.
|
msg289114 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-06 15:11 |
Thanks all!
|
msg289115 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-03-06 15:16 |
Unhappy buildbot.
http://buildbot.python.org/all/builders/AMD64%20Debian%20root%203.x/builds/456/steps/test/logs/stdio
======================================================================
ERROR: test_keyword_arguments (test.test_descr.ClassPropertiesAndMethods)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_descr.py", line 3451, in test_keyword_arguments
list.__init__(a, sequence=[0, 1, 2])
TypeError: list() does not take keyword arguments
======================================================================
ERROR: test_keywords (test.test_descr.ClassPropertiesAndMethods)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_descr.py", line 2888, in test_keywords
self.assertEqual(int(x=1), 1)
TypeError: 'x' is an invalid keyword argument for this function
|
msg290285 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2017-03-24 22:47 |
New changeset d908fd9ee1c307f7066023eb2031c0f509036cbc by Brett Cannon (Serhiy Storchaka) in branch 'master':
bpo-29695: Fixed tests after removing keyword args support in some basic type constructors. (GH-520)
https://github.com/python/cpython/commit/d908fd9ee1c307f7066023eb2031c0f509036cbc
|
msg290289 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-24 22:49 |
New changeset 2e5642422f6234fd8d0c082142b27340e588f96e by Serhiy Storchaka in branch 'master':
bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() and tuple(). (#518)
https://github.com/python/cpython/commit/2e5642422f6234fd8d0c082142b27340e588f96e
|
msg290294 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-03-24 22:53 |
New changeset 58d23e68068996c76cac78887ec67dee68cdbc72 by Serhiy Storchaka in branch 'master':
bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486)
https://github.com/python/cpython/commit/58d23e68068996c76cac78887ec67dee68cdbc72
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:43 | admin | set | github: 73881 |
2017-03-31 16:36:09 | dstufft | set | pull_requests:
+ pull_request847 |
2017-03-24 22:53:00 | serhiy.storchaka | set | messages:
+ msg290294 |
2017-03-24 22:49:54 | serhiy.storchaka | set | messages:
+ msg290289 |
2017-03-24 22:47:17 | brett.cannon | set | nosy:
+ brett.cannon messages:
+ msg290285
|
2017-03-17 21:00:33 | larry | set | pull_requests:
+ pull_request589 |
2017-03-07 19:47:54 | serhiy.storchaka | set | status: open -> closed resolution: fixed |
2017-03-06 15:39:58 | serhiy.storchaka | set | pull_requests:
+ pull_request430 |
2017-03-06 15:16:04 | vstinner | set | status: closed -> open resolution: fixed -> (no value) messages:
+ msg289115
|
2017-03-06 15:11:25 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages:
+ msg289114
stage: patch review -> resolved |
2017-03-06 14:50:45 | r.david.murray | set | messages:
+ msg289110 |
2017-03-06 14:34:51 | serhiy.storchaka | set | messages:
+ msg289107 |
2017-03-06 14:34:05 | serhiy.storchaka | set | pull_requests:
+ pull_request428 |
2017-03-06 14:24:33 | vstinner | set | messages:
+ msg289105 |
2017-03-06 07:04:51 | rhettinger | set | messages:
+ msg289068 |
2017-03-06 06:54:15 | serhiy.storchaka | set | files:
+ remove-bad-keywords.patch
messages:
+ msg289067 |
2017-03-05 23:32:41 | rhettinger | set | nosy:
+ rhettinger messages:
+ msg289052
|
2017-03-05 21:55:08 | serhiy.storchaka | set | pull_requests:
+ pull_request399 |
2017-03-02 18:18:58 | gvanrossum | set | nosy:
- gvanrossum
|
2017-03-02 16:05:13 | serhiy.storchaka | set | files:
+ deprecate-bad-keywords.patch
messages:
+ msg288811 |
2017-03-02 15:42:41 | serhiy.storchaka | set | messages:
+ msg288809 |
2017-03-02 15:37:54 | r.david.murray | set | messages:
+ msg288808 |
2017-03-02 15:22:25 | vstinner | set | messages:
+ msg288806 |
2017-03-02 15:12:40 | serhiy.storchaka | set | messages:
+ msg288805 |
2017-03-02 15:09:58 | vstinner | set | messages:
+ msg288804 |
2017-03-02 14:59:22 | r.david.murray | set | nosy:
+ r.david.murray messages:
+ msg288803
|
2017-03-02 14:54:17 | serhiy.storchaka | set | files:
+ deprecate-keyword-sequence.patch |
2017-03-02 14:54:04 | serhiy.storchaka | create | |