这种语法无效?

sky*_*erl 1 python syntax class definition

我有一个python模块,它包含许多函数定义,都是静态的.然后在最后我添加了一个类定义,然而,解释器给我提供了以下错误:

    Traceback (most recent call last):                                                                                                      
  File "~/file.py", line 136                                                                         
    class InvalidPredicateError(Exception):                                                 
        ^                                                                                   
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

我根本没有看到这个问题.是因为我试图在静态模块中定义一个类吗?

Fre*_*urk 11

课前的行有错误.例如:

$ cat -n pyinvclass.py
     1  def f():
     2    return (1, 2
     3  
     4  class InvalidPredicateError(Exception):
     5    pass
$ python pyinvclass.py
  File "pyinvclass.py", line 4
    class InvalidPredicateError(Exception):
        ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)