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

test_function_definition: if Nothing included in function def --> Improve syntax error messaging #8

Closed
hugobowne opened this issue May 26, 2016 · 3 comments
Assignees

Comments

@hugobowne
Copy link

hi!

interesting issue: if student writes nothing after def (): within scope of function, then Python throws an error and SCT doesn't work. See screenshot. any cheeky work-around?

screen shot 2016-05-26 at 5 05 56 pm

@vvnkr
Copy link
Member

vvnkr commented May 26, 2016

The problem here is that this is a syntax error (IndentationError inherits from SyntaxError), so the code can not be parsed. There's no work around.

This also was a problem in testwhat, and what we did there is start writing a parser that recognises certain typical syntax errors and generates better readable feedback for them. This is wat we plan to do for pythonwhat too at some point.

@hugobowne
Copy link
Author

Very interesting! Worth thinking about in more detail at some point as Intermediate Python II will contain a Chapter on user-defined functions and this will be important there.

@filipsch filipsch changed the title test_function_definition: if Nothing included in function def test_function_definition: if Nothing included in function def --> Improve syntax error messaging May 31, 2016
@filipsch filipsch self-assigned this Jul 1, 2016
@filipsch
Copy link
Contributor

filipsch commented Jul 4, 2016

@hugobowne I'll close this issue for now.
Makes more sense to see this as a general feature of adding syntax error diagnostics to SCT output.
See #42

@filipsch filipsch closed this as completed Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants