Thanks for confirming! Is this a known problem, or should I go ahead and report an issue on GitHub? (I didn't see anything when I checked before, but I may have overlooked it).
On Wednesday, March 6, 2019 at 10:52:27 AM UTC-6, Matthias Bussonnier wrote: > > That is an oversight and a bug in IPython, it is likely due to the fact > that we attempt to parse top-level async-code. > We fixed similar bugs in recent IPython that allowed top level `break`, > and `continue`. > This should raise a SyntaxError. > -- > Matthias > > > On Wed, 6 Mar 2019 at 08:44, Tyler Caraza-Harter <[email protected] > <javascript:>> wrote: > >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jupyter/5df252cb-f76d-4972-887b-37346df82fdc%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jupyter/5df252cb-f76d-4972-887b-37346df82fdc%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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/002f4c02-ea74-4708-a500-485b15191600%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
