Я получаю синтаксическую ошибку в коде, который, я думаю, имеет правильный синтаксис.
from abc import ABC, abstractmethod
from typing import Any, Optional
class Handler(ABC):
"""
The Handler interface declares a method for building the chain of handlers.
It also declares a method for executing a request.
"""
@abstractmethod
def set_next(self, handler: Handler) -> Handler:
pass
@abstractmethod
def handle(self, request) -> Optional[str]:
pass
вывод из i python:
Syntax error
File "/home/laci/git/python_playground/chain.py", line 12
def set_next(self, handler: Handler) -> Handler: