TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How the Python import system works

2 点作者 r4victor将近 4 年前

2 条评论

r4victor将近 4 年前
Hi! This is part 11 of my Python behind the scenes series. I&#x27;ve been programming in Python for quite a while but didn&#x27;t really understand how the import system works: what modules and packages are exactly; what relative imports are relative to; what&#x27;s in sys.path and so on. My goal with this part was to answer all these questions. After you read it, you should be able to tell what exactly happens during the import process.<p>I welcome your feedback and questions. Thanks!
ksaj将近 4 年前
These articles are quite good. Thanks for posting them.<p>I like the encyclopedic process of picking a topic, and digging in as deep as one can go. I had no idea there was so much going on with Python&#x27;s import system until now.<p>Having said that, I think you might have missed a swell feature: import xx as y.<p>I think most people use it just to simplify function names, but it&#x27;s especially important for people who create their own private libraries, which inevitably result in function name clashes down the line. I guess also if you tend to use a lot of similar libraries, like what often happens with networking or math.<p>Anyway, I&#x27;m just learning Python, so you gained at least one new reader here.
评论 #27841215 未加载