Skip to content

! after line continuation causes SyntaxError #8987

Closed

Description

@kapare

Hi! I was playing with IPython and something stop working as expected... It took me a bit of testing to found out why and I'm wondering if this is an expected behaviour or not?
Here the src that cause the problem: https://gist.github.com/kapare/6969b2a58b7855a0b2f3
[1] The line that make SyntaxError: is 98 but it display line 92.
[2] Splitting the string at 94 cause the SyntaxError? Is it expected?

Activity

  1. changed the title [-]IPython raise SyntaxError: invalid syntax after a string is split in argparse.add_argument[/-] [+]! after line continuation causes SyntaxError[/+] on Nov 13, 2015
  2. minrk commented on Nov 13, 2015

    @minrk
    Member

    From gitter, a smaller example that reproduces the issue:

    str("bla \
    bla.")
    !pwd
  3. takluyver commented on Jan 26, 2016

    @takluyver
    Member

    The smaller example does not reproduce it for me in master, even when saved to a .ipy file. I think it has to be an explicit line continuation within a multiline Python expression, and not on the first line. This reproduces it:

    str(
    "bla \
    bla.")
    !pwd
    
  4. self-assigned this
    on Jan 26, 2016
  5. MrMino commented on Mar 27, 2022

    @MrMino
    Member

    Neither of the two examples produce SyntaxError anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions