[Python] In Python, what's the purpose of giving an alias with the same name as the imported...

Discussão em 'Python' iniciado por Stack, Março 20, 2025.

  1. Stack

    Stack Membro Participativo

    When I was reading the source code of aiohttp, I found the code below: click here for code

    from .web_exceptions import (
    HTTPAccepted as HTTPAccepted,
    HTTPBadGateway as HTTPBadGateway,
    HTTPBadRequest as HTTPBadRequest,
    HTTPClientError as HTTPClientError,
    HTTPConflict as HTTPConflict,
    HTTPCreated as HTTPCreated,
    HTTPError as HTTPError,
    ...
    )


    I don't understand why we need a import A as A here. Are there any benefits?

    Continue reading...

Compartilhe esta Página