Author r.david.murray
Recipients W deW, docs@python, eryksun, martin.panter, r.david.murray, vstinner
Date 2015-09-23.18:10:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443031841.83.0.446173190096.issue25205@psf.upfronthosting.co.za>
In-reply-to
Content
I wouldn't call the sendfile case troublesome.  'in' is a keyword, so if you want to use it in function arguments, you have to pass it as a string.  Perfectly logical :)

IIRC pypy uses an optimized dictionary if there are no non-identifier keywords in the attribute __dict__.  I *think* it supports non-identifiers by falling back to a slower implementation, but I could be wrong.  I seem to remember a discussion where it was ruled that the fact that CPython's default __dict__ accepts non-identifiers is a CPython implementation detail and code should not rely on it working...but of course some code does, so we can't "fix" it :).

If I'm remembering right, and if __dict__'s permissiveness is not noted as a CPython implementation detail in the language reference, it should be, but I would expect that it is since that discussion was one of the ones that triggered the introduction such documentation notes.

But, as MvL pointed out, setattr does *not* have this restriction, even if the python implementation rejects it for default __dicts__, because an object can do anything it wants during in its __setattr__ method, and this is an important (and used in the wild!) feature of the language.
History
Date User Action Args
2015-09-23 18:10:41r.david.murraysetrecipients: + r.david.murray, vstinner, docs@python, martin.panter, eryksun, W deW
2015-09-23 18:10:41r.david.murraysetmessageid: <1443031841.83.0.446173190096.issue25205@psf.upfronthosting.co.za>
2015-09-23 18:10:41r.david.murraylinkissue25205 messages
2015-09-23 18:10:41r.david.murraycreate