[issue35105] Document that CPython accepts "invalid" identifiers

2021-08-13 Thread Andrei Kulakov
Andrei Kulakov added the comment: In the last message I've said that according to __dict__ docs, anything in __dict__ is an attribute of respective obj. That's a bit too-strongly worded, the docs can be understood in the sense that anything that ends up in __dict__ via other mechanisms,

[issue35105] Document that CPython accepts "invalid" identifiers

2021-08-13 Thread Andrei Kulakov
Andrei Kulakov added the comment: It seems like the documentation is lacking and perhaps misleading in regard to attributes. - anything hashable can be used as a key in an obj.__dict__: an int, a tuple, etc. According to __dict__ docs, all of those are attributes. There's no warning that

[issue35105] Document that CPython accepts "invalid" identifiers

2020-07-03 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35105] Document that CPython accepts "invalid" identifiers

2020-07-02 Thread Roy Smith
Roy Smith added the comment: Just as another edge case, type() can do the same thing: Foo = type("Foo", (object,), {"a b": 1}) f = Foo() for example, will create a class attribute named "a b". Maybe this actually calls setattr() under the covers, but if it's going to be documented, it

[issue35105] Document that CPython accepts "invalid" identifiers

2019-01-04 Thread Windson Yang
Windson Yang added the comment: I agreed with @Raymond Hettinger, I will update the PR from your suggestion if no other ideas in next week. -- ___ Python tracker ___

[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, the only restriction added by setattr() is that *name* must be a string. -- ___ Python tracker ___

[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't think we can mark this as an implementation detail for setattr(). The details are downstream and determined by the target object, not by setattr() itself. Suggested wording: ''' Note, setattr() attempts to update the object with the given

[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-20 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +10494 stage: -> patch review ___ Python tracker ___ ___

[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Any ideas? Or I will create a PR in a week without 'CPython implementation > detail' I don't think we want to give any stability guarantees for this. Perhaps we should explicitly state that this is not guaranteed behaviour and may change in the future.

[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-08 Thread Windson Yang
Windson Yang added the comment: Any ideas? Or I will create a PR in a week without 'CPython implementation detail' -- ___ Python tracker ___

[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-08 Thread Windson Yang
Windson Yang added the comment: I try to create a PR for it. Should we add 'CPython implementation detail' at the document? Because this happens at cpython as well as pypy. BTW, where should we add the document? I have two choices. *

[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-05 Thread orlnub123
orlnub123 added the comment: I take back my previous suggestion, I agree that documenting it in setattr() (and **kwargs) is the way to go. It's obvious that you can assign anything to the __dict__, since it represents a dict, but setattr() is more ambiguous. 'Anything' was the key word for

[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: Documenting something as an 'implementation detail' denies that it is a language feature and does not offer stability guarantees. -- ___ Python tracker

[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-03 Thread Chris Jerdonek
Chris Jerdonek added the comment: > In the pydev thread, Guido said "My feeling is that limiting it to strings is > fine, but checking those strings for resembling identifiers is pointless and > wasteful." But in a later message, after additional discussion, he acknowledged there could be

[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-03 Thread Ned Batchelder
Ned Batchelder added the comment: This seems like a confusion of two things: identifiers are lexical elements of the language. Attributes are not limited to identifiers. We could add to the docs for setattr: "The attribute name does not have to be a valid identifier." I don't know what

[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-02 Thread STINNER Victor
STINNER Victor added the comment: > I don't know the proper markup for these. It's ".. impl-detail::". See for example: https://docs.python.org/dev/library/codecs.html#standard-encodings -- ___ Python tracker

[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: It is an implementation detail that some people need to know, and that is very unlikely to change. In the pydev thread, Guido said " My feeling is that limiting it to strings is fine, but checking those strings for resembling identifiers is pointless and

[issue35105] Document that CPython accepts "invalid" identifiers

2018-10-31 Thread orlnub123
orlnub123 added the comment: The customizing attribute access section of the data model might be a suitable place. -- ___ Python tracker ___

[issue35105] Document that CPython accepts "invalid" identifiers

2018-10-31 Thread Windson Yang
Windson Yang added the comment: I agreed we should document it, it' not obvious to me at least. -- nosy: +Windson Yang ___ Python tracker ___

[issue35105] Document that CPython accepts "invalid" identifiers

2018-10-31 Thread STINNER Victor
STINNER Victor added the comment: > I'd argue that it's an implementation detail. Documenting it might be nice as > some projects such as pytest do use it but I don't think it would make sense > in setattr() or getattr() since all they do (at least in this case) is > assign/retrieve from

[issue35105] Document that CPython accepts "invalid" identifiers

2018-10-31 Thread orlnub123
orlnub123 added the comment: I'd argue that it's an implementation detail. Documenting it might be nice as some projects such as pytest do use it but I don't think it would make sense in setattr() or getattr() since all they do (at least in this case) is assign/retrieve from the __dict__.

[issue35105] Document that CPython accepts "invalid" identifiers

2018-10-31 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: +pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35105] Document that CPython accepts "invalid" identifiers

2018-10-29 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35105] Document that CPython accepts "invalid" identifiers

2018-10-29 Thread STINNER Victor
New submission from STINNER Victor : The Python 3 language has a strict definition for an identifier: https://docs.python.org/dev/reference/lexical_analysis.html#identifiers ... but in practice, it's possible to create "invalid" identifiers using setattr(). Example with PyPy: $ pypy Python