Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Replace the usage of Any with generic types #138

Copy link
Copy link
Closed
@vdusek

Description

@vdusek
Issue body actions

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 the following

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    debtCode quality improvement or decrease of technical debt.Code quality improvement or decrease of technical debt.t-toolingIssues with this label are in the ownership of the tooling team.Issues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.