Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from typing import *
- def example_decorator(
- fn: Callable[[List[str]], List[str]]
- ) -> Callable[[List[str]], str]:
- def wrapper(data: List[str]) -> str:
- res = fn(data)
- return ', '.join(res)
- return wrapper
- @example_decorator
- def func(data: List[str]) -> List[str]:
- data.append('XYZ')
- return data
- def test() -> str:
- result = func(['ABC', 'EFG'])
- print(type(result)) # <class 'str'>
- return result # Incompatible return type [7]: Expected str but got typing.List[str].
- test()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement