Say we have this code:
def deco(f):
return lambda x: f(x + 1)
@deco
def myfunc(x):
return 1 / x
myfunc(0)
Trying to evaluate the myfunc function will be wrong in two different ways: if I have my cursor on the @deco line, it causes a syntax error because it seems to just be trying to evaluate @deco by itself, without the function definition after it. If I have my cursor on the def myfunc line, or on the blank line immediately after myfunc, it defines the function _without_ the decorator.
I can work around this by manually selecting the whole function definition including the decorator line and then hitting cmd-alt-enter.
Hydrogen relies on Atom's code-folding and indentation right now to figure out what a block is. This is so that the code for finding blocks works across languages.
This is definitely annoying behavior, but I don't know of a way to address this without writing a parser for each language that Hydrogen supports. Which maybe we should do at some point, but isn't going to happen for a while.
Any ideas about how to solve this without breaking the problem out into all the languages?
sorry, I don't have any ideas. is it a bug in atom?
Nope, it's just hard to take a bunch of text and figure out what a logical block is cross-language. Atom is correct not to fold to decorators, as that would fold the actual function definition under.
any suggestion to get around this problem?
@alvis A way around this is to use comments to define the execution cells in your code and use the command Hydrogen Run Cell and Move Down (Alt+Shift+Enter) to run them. E.g.:

@n-riesco: Thanks for pointing out. It's smart to use the # In[]: syntax to separate cells. Never thought it'd be a way.
Please have a look if the most recent commit in this PR nikitakit/hydrogen-python#10 work for you. I've just added exactly this functionality.
This is as solved as possible through the use of cells and with hydrogen-python so I'm going to close.
Most helpful comment
@alvis A way around this is to use comments to define the execution cells in your code and use the command
Hydrogen Run Cell and Move Down (Alt+Shift+Enter)to run them. E.g.: