惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
The Cloudflare Blog
博客园 - 【当耐特】
博客园 - 叶小钗
量子位
博客园 - 聂微东
S
SegmentFault 最新的问题
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
宝玉的分享
宝玉的分享
小众软件
小众软件
罗磊的独立博客
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog

Anže's Blog

The 15-Year-Old iptables Rule That Broke My DNS Fedidevs 9h Outage Postmortem Letting Claude Upgrade My Raspberry Pi Agents Day Lisbon DjangoCon Europe 2026 How to Safely Update Your Dependencies Speeding Up Django Startup Times with Lazy Imports Typing Your Django Project in 2026 Claude Fixes User Bug Jekyll to Hugo Migration Advent of Code 2025 🎄 Django bulk_update Memory Issue Migrating Gunicorn to Granian Disable Network Requests When Running Pytest Disable Runserver Warning in Django 5.2 Autogenerating og:images with Jekyll Power Outages and Gunicorn PID Files UV with Django Go-like Error Handling Makes No Sense in JavaScript or Python Packages Do Not Match the Hashes Pip Error Gotchas with SQLite in Production Fedidevs Dev Update #2 Django SQLite Production Config Django Streaming HTTP Responses Deploying a Django Project to My Raspberry Pi (Video) Thoughts on Code Reviews Django SQLite Benchmark Django, SQLite, and the Database Is Locked Error No Downtime Deployments with Gunicorn SQLite Write-Ahead Logging
import __hello__
Anže Pečar · 2023-01-07 · via Anže's Blog

In the latest episode of the Real Python Podcast the topic of Python Easter Eggs came up. One of the mentioned easter eggs was import __hello__:

>>> import __hello__
Hello World!
>>> import __phello__
Hello world!

There is even a spam version of it:

>>> import __phello__.spam
Hello world!
Hello world!

Batteries included

It makes sense that Python - the language with batteries included - also includes a hello world program, one import away right?

These top-level modules weren’t added just for fun, according to the comment in the CPython source code they were added for testing frozen modules:

/* In order to test the support for frozen modules, by default we
   define some simple frozen modules: __hello__, __phello__ (a package),
   and __phello__.spam.  Loading any will print some famous words... */

Python 3.11

In Python 3.11 the __hello__ and __phello__ modules no longer print the text when they are imported. You now have to call the module’s main method to get the same effect:

>>> import __hello__
>>> __hello__.main()
Hello World!
>>> import __phello__
>>> __phello__.main()
Hello World!

This isn’t the first time the __hello__ imports broke in a newer Python version. The same thing also happened in the initial versions of Python 3 (3.1, 3.2, 3.3, 3.4) according to this issue from 2011.

Even though the easter egg was fixed back in 2011, it looks like the change in Python 3.11 was intentional and won’t be reverted.