Inconsistency of `?` to get help: syntax: invalid identifier name "?"

Sometimes I use ? to get help on a function. For a given function called f, I type ?f and then run the cell and it gives info for that function. But sometimes this doesn’t work. For example right now I have two different cells in a Jupyterlab where it works in one cell but not the other. If I type ?maximum into one cell it gives me help but in another cell it says syntax: invalid identifier name “?”.

My Jupyterlab has a number of problems so maybe I just need to reinstall that or something.

? has to be the first non-whitespace character in the cell.

(You can also just put the cursor at an identifier and type shift-tab to get a pop-up docstring.)


In jupyter, I usually end up just using the @doc macro instead of ?. It’s only a few more characters and doesn’t have the same limitations.