apify-client-python icon indicating copy to clipboard operation
apify-client-python copied to clipboard

Replace the usage of `Any` with generic types

Open vdusek opened this issue 1 year ago • 0 comments

Do not use Any type as suggested in the ANN401.

Instead of

from typing import Any

def get_first(container: list[Any]) -> Any:
    return container[0]

use generic type

from typing import TypeVar

T = TypeVar('T')

def get_first(container: list[T]) -> T:
    return container[0]

Any can probably still make sense for the *args / **kwargs.

vdusek avatar Nov 20 '23 12:11 vdusek