really silly nit: why 3+5j instead of 3+5i?

Neil Hodgson neilh at
Sun May 14 09:18:49 EDT 2000

> I'm quite a newbie (read very), but it seems that there is a precedent
> in strings which can be either ' or " but ' is used for printing. Is
> this now considered to have been a mistake or a special case?

   Allowing i instead of j does not make any task significantly easier nor
the resulting code clearer. Having two forms of quote makes manipulation of
strings that contain quotes much easier. A lot of my Python code generates
HTML with embedded JavaScript so there is stuff like:

out = out + "<TD id='%s' class='itemtext' style='%s'>" % (itemName,

print "item = new Item(%s,'%s');\n" % (did, dispatch['itemID'])

   or when you have to use layers of quotes there are Python's triple

itemstart="""<A class='itemdate' href='javascript:ShowHide("%s");'>%s</A>"""

   Using backslash quoting instead is very tedious and prone to mistakes.

   However I see no need for python to have both single triple quotes and
double triple quotes. Maybe its just the symmetry.


More information about the Python-list mailing list