Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.
This repository was archived by the owner on May 27, 2022. It is now read-only.

print as last expression fails in notebook #16

@actsasgeek

Description

@actsasgeek

If you use print as the last expression in an s-expression:

(let [[a 1]]
  (print a))

You get the following error:

 File "<ipython-input-12-d8822250c158>", line 3
    return print(a)
               ^
SyntaxError: invalid syntax

Looking at the generated python, I can see why it is an error but because it works in the Hy REPL so I imagine it has something to do with the way Hy has been interfaced to the expectations of the notebook. Because the notebook only prints the return value of the last expression executed, using print statements for everything you want to see is a common pattern.

Thanks!

There is a bit of a kludge for now...

(let [[a 1] [b 2]
  (print a)
  None)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions