Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-07 Thread Stephen J. Turnbull
Terry Reedy writes: > When this behavior of set/getattr was discussed a decade or so ago, > Guido said not to disable it, but I believe he said it should not > be considered a language feature. There are other situations where > CPython is 'looser' than the spec. I'm pretty sure that all of

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-07 Thread Terry Reedy
On 10/7/2018 1:34 PM, Chris Barker via Python-Dev wrote: On Fri, Oct 5, 2018 at 3:01 PM Brett Cannon > wrote: I'm also fine with saying that keys in **kwargs that are not proper identifiers is an implementation detail. It's not just **kwargs -- you can also use

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-07 Thread Chris Barker via Python-Dev
On Sun, Oct 7, 2018 at 11:42 AM João Santos wrote: > *locals *and *globals* are documented as dictionaries (for example exec's > documentation states that " If only *globals* is provided, it must be a > dictionary") > well, that is specifically about exec() -- it may or may not apply to everywhe

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-07 Thread Simon Cross
I would consider it a feature. My reasoning is that the restriction on what can be used as an identifier is a syntax restriction, not a general restriction on what attributes or names can be. ___ Python-Dev mailing list Python-Dev@python.org https://mail.

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-07 Thread João Santos
*locals *and *globals* are documented as dictionaries (for example exec's documentation states that " If only *globals* is provided, it must be a dictionary") but __dict__ is described as " [a] dictionary or other mapping object". On Sun, 7 Oct 2018 at 19:38, Chris Barker via Python-Dev < python-

Re: [Python-Dev] Arbitrary non-identifier string keys when using **kwargs

2018-10-07 Thread Chris Barker via Python-Dev
On Fri, Oct 5, 2018 at 3:01 PM Brett Cannon wrote: > I'm also fine with saying that keys in **kwargs that are not proper > identifiers is an implementation detail. > It's not just **kwargs -- you can also use arbitrary names with setattr() / getattr() : In [6]: setattr(foo, "4 not an identifier