Performance? Nope. *import requests as req* compiles to the same bytecode as *import requests*. It’s purely cosmetic.
I alias when:
- The name’s too long (*cough* matplotlib *cough*).
- I’m using multiple similar libs (e.g., *req* for requests, *httpx* for HTTPX).
For *requests*, I’d only alias if the script is huge. Otherwise, it’s overkill.
I alias when:
- The name’s too long (*cough* matplotlib *cough*).
- I’m using multiple similar libs (e.g., *req* for requests, *httpx* for HTTPX).
For *requests*, I’d only alias if the script is huge. Otherwise, it’s overkill.
