Skip to content

[Solved] SyntaxError: non-default argument follows default argument

Today when I build a model for deep learning, I got a rarely error message. In the past two years, I thought I had seen all python error messages.

SyntaxError: non-default argument follows default argument

This error message is very simple but easy to happen.

As prompted in the message: I put the non-default argument follow the default argument.

This is unreasonable in the python syntax.

The syntax I had seen in the past, may be in the python document.


Solution

The solution is hint by the error message, the order I set the arguments is wrong, reverse their order and the program can work.

Wrong Example


Change to:

Correct Example

References

Tags:

Leave a ReplyCancel reply

Exit mobile version