What's the correct way to use 'import requests as' in Python? or Why do some scripts use 'import requ

18 Replies, 1743 Views

Honestly, I only use *import requests as* when the module name is super long or clashes with another variable. For *requests*, it’s short enough that I rarely bother.

But hey, if you’re in a team, check their style guide. Some projects enforce aliasing for consistency.

No right or wrong here—just don’t alias it as *import requests as requests* (seen it happen, facepalm).

Messages In This Thread



Users browsing this thread: 1 Guest(s)