why Python string changes to italic looking in the Canopy editor when moved to new line?

133 views Asked by At

This is probably an editor snag. But thought to check in case, as I do not know Python and just started to learn it.

Comparing the following

Mathematica graphics

And I simply move the second field one line below by hitting return

Mathematica graphics

The code in the second line became italic. I thought at first I have some syntax error or the editor is warning me about something, but there is no problem and the code run just as before. This only happens when the """ use. With a single " then the code does not become italic.

Do you think this is just an editor issue, or is the editor trying to tell something I should not be doing?

Specs: Windows 7, Enthought Canopy 1.5.4 (64 bit)

code in plain text:

   data = [r"""123""",r"""456"""]
1

There are 1 answers

0
Ben Longo On BEST ANSWER

Without being able to see the documentation for your editor, I would guess that the italics is there to signify that the line is wrapped and is not trying to warn you of anything. As stated in PEP, "Continuation lines should align wrapped elements either vertically using Python's implicit line joining inside parentheses, brackets and braces, or using a hanging indent". wrapping lines like you're doing is completely ok and the editor shouldn't be warning you of anything.