Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: SyntaxError: 'return' outside function #892

Closed
jinyangustc opened this issue Aug 8, 2015 · 1 comment
Closed

Python: SyntaxError: 'return' outside function #892

jinyangustc opened this issue Aug 8, 2015 · 1 comment

Comments

@jinyangustc
Copy link

I'm using the default prelude python configuration and have a problem with 'Eval defun'. When I eval the def block (M-C-x), I got an error in the python shell:

SyntaxError: 'return' outside function

The test code are here:

def twoSum(nums, target):
    index = {}
    for i, val in enumerate(nums, 1):
        try:
            return index[target - val], i
        except:
            index[val] = i

I've also tried 'Eval region' and it works well.

Could you please help me with this problem?

@bbatsov
Copy link
Owner

bbatsov commented Aug 10, 2015

That's likely a bug in python-mode or something.

@bbatsov bbatsov closed this as completed Aug 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants