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?
Following the Git blame to the original commit, and following that to the pull request and associated issue, shows that this was to make mypy happy. mypy --strict
didn't like the no-as
form for re-exported imports.