I was recently surprised by a return statement in the cell of a notebook I 
was reading, something like this (I simplified the original to highlight 
the strange behavior):

def f():
    pass


return 5

To my surprise, running this cell did not cause an exception.  Instead, 5 
went to the Out.  Is this a bug, or is this behavior expected?

Surprisingly, I do get an error (SyntaxError: 'return' outside function) 
when I have a return without a proceeding function:

return 5

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/5df252cb-f76d-4972-887b-37346df82fdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to