[Python-Dev] Very Strange Argument Handling Behavior (original) (raw)
Guido van Rossum guido at python.org
Fri Apr 16 16:33:28 CEST 2010
- Previous message: [Python-Dev] Very Strange Argument Handling Behavior
- Next message: [Python-Dev] Very Strange Argument Handling Behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Apr 16, 2010 at 7:15 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
Mark Dickinson wrote:
"dict(x, **y)" as an expression version of x.update(y) seems to be fairly well known[1], so disallowing non-string keyword arguments seems likely to break existing code, as well as (probably?) harming performance. So I can't see CPython changing here. I'm not sure whether other implementations should be required to follow suit, though---maybe this should be regarded as an implementation-defined detail? I would agree with leaving it implementation defined - I don't think either PyPy or CPython should be forced to change their current behaviour in relation to this. A minor note in the language reference to that effect may be worthwhile just to make that stance official.
That is just going to cause some programs to have a portability surprise. I think one or the other should be fixed. I am fine with declaring dict({}, **{1:3}) illegal, since after all it is abuse of the ** mechanism. We should deprecate it in at least one version though.
-- --Guido van Rossum (python.org/~guido)
- Previous message: [Python-Dev] Very Strange Argument Handling Behavior
- Next message: [Python-Dev] Very Strange Argument Handling Behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]