(original) (raw)

My feeling is that limiting it to strings is fine, but checking those strings for resembling identifiers is pointless and wasteful.

On Tue, Oct 9, 2018 at 9:40 AM Jeff Hardy <jdhardy@gmail.com> wrote:
On Sun, Oct 7, 2018 at 3:45 PM Terry Reedy <tjreedy@udel.edu> wrote:
\>
\> On 10/7/2018 1:34 PM, Chris Barker via Python-Dev wrote:
\> > On Fri, Oct 5, 2018 at 3:01 PM Brett Cannon <brett@python.org
\> > brett@python.org>> 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", "this works")
\> >
\> > In \[7\]: getattr(foo, "4 not an identifier")
\> > Out\[7\]: 'this works'
\>
\> 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.

\>From an alternative implementation point of view, CPython's behaviour
\*is\* the spec. Practicality beats purity and all that.

\- Jeff
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org
--
--Guido (mobile)