Python String Sucks

By Xah Lee. Date: . Last updated: .

Python got the worst design for string. Let me explain.

# python string syntaxes

"""triple double"""
'''triple single'''

r'raw single'
r"raw double"
r"""raw triple double"""
r'''raw triple single'''

Diff string syntax in a programing language, is to solve the problem of:

Now, most lang solve these by:

now, the way python tried to solve this, is:

first, it has both apostrophe and double quote char, as equivalent delimitors, for its so called short string faak. And this python short-string faak, cannot have literal line return.

This is a bad design. Because having 2 syntax to do the same thing, and they are essentially the same, except if the string contains a single or double quote, which in real life often contain both. So the python short-string syntax is one idiotic faak.

Then, python the guido von rossum idiot, created triple quote, to solve the arbitrary big string problem. This is idiotic because, it is inferior to the here-string, cuz ur string content could contain python code involving triple quote, u got a problem.

Then, the guido von rossum idiot, created raw string concept, with the r prefix. Trying to solve the non-issue of whether escape sequence should be interpreted as literal. There is no mechanism to embed variable in string.

What guido should've done, is in python 3, make the single quote delimeter as raw string and rid of the r raw string prefix.