
On Mon, Jan 17, 2022 at 2:01 PM Steven D'Aprano <steve@pearwood.info> wrote:
Yes. ONLY on strings. That's exactly what I said. Strings are different. For starters, we already have multiple different data types that can come from quoted literals, plus a non-literal form that people treat like a literal (f-strings). Is there any non-string type that doesn't follow that pattern?
So... not "ONLY" (your emphasis, not mine) strings. As you say, there are already two different data types, strings and bytes, plus a non-literal executable code (f-strings).
Again, I don't understand your point. You have just told us that there are already non-string literals and types that use a prefix on the delimiter, and then you ask me if there are any non-string types that follows that pattern. Haven't you just answered your own question?
An f-string still yields a string. It's not a literal but it's still a string. A bytestring is still a string. It's not a Unicode string but it's still a string. These are not the same as lists, tuples, sets, dicts, etc, which contain arbitrary objects. ONLY strings. You just picked up on the part where I said "not only literals" and got it completely backwards. Strings are not the same as lists. Strings are not the same as tuples. Strings are the only data type in Python that has prefixes that determine the data type you get. Strings are TREATED DIFFERENTLY by programmers, which is why f-strings get treated like string literals. Strings. Are. Different. I do not know how to make this any clearer. If you do not understand my position, please stop misrepresenting me. ChrisA