Search code examples
pythonline-continuation

Python in VS Code Not Allowing Implicit Line Continuation?


I was reading that Python allows for implicit line continuation as long as you are in brackets or parentheses; however in VS Code it doesn't seem to allow this behavior for me, and I'm required to use the explicit forward slash line continuation.

plt.title("Monte Carlo Dice Game [" + str(num_simulations) + "
      simulations]")

Pylance error triggered: VS Code Error

Is there some sort of setting which I need to enable to allow implicit line continuation?

Tried using a return/linebreak within the parentheses of a function call, expecting no errors to pop up within VS Code, but an error occurred.


Solution

  • Per Barmar:

    You can have line breaks in argument lists, but you can't have them inside strings unless you use triple quotes. – Barmar 3 hours ago

    Not sure where this is documented officially but it seems to be the best answer.