This may be a rather esoteric question.
Python has some easter eggs I like to show my friends, one being
import __hello__
>>> Hello World!
With this one, I also know it has a practical use as a basic sanity check for import shenanigans
Now, in my memory I recall that it used to automatically print Hello World, but now I have to manually call __hello__.main() to make the message appear. I have tested it using those methods:
- via the interactive python interpreter
$ python
Python 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import __hello__
>>> # No output
- via
python -c
$ python -c "import __hello__"
$ # No output
- via a file
$ echo "import __hello__" >> hello.py
$ python hello.py
$ # No output
I also found a source which says that this behaviour only started in Python 3.11
Hello world for python >= 3.11
>>> import __hello__ >>> __hello__.main() Hello World!
I wonder if this there is a reason for this new behavior, I looked at the changelog of python and, using ctrl + f "__hello__" found two issues linked but nothing else. I can imagine some CI workflows may have been broken which expected Hello World in stdout after testing import __hello__, so I’m interested if there has been discussions around it or if this is a very weird regression which nobody noticed
Information that may be interesting
python --version --version
Python 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]
fastfetch --pipe (Logo manually removed)
laura@programs
--------------
OS: Arch Linux x86_64
Host: HP Laptop 15-dw3xxx
Kernel: Linux 6.16.1-arch1-1
Uptime: 4 days, 5 hours, 32 mins
Packages: 1498 (pacman)
Shell: bash 5.3.3
Display (AUO3791): 1920x1080 @ 60 Hz in 16" [Built-in]
DE: KDE Plasma 6.4.4
WM: KWin (Wayland)
WM Theme: exposeair
Theme: Breeze (ExposeAir) [Qt], Breeze [GTK2/3]
Icons: ExposeAir [Qt], ExposeAir [GTK2/3/4]
Font: Noto Sans (10pt) [Qt], Noto Sans (10pt) [GTK2/3/4]
Cursor: breeze (24px)
Terminal: konsole 25.8.0
CPU: 11th Gen Intel(R) Core(TM) i5-1135G7 (8) @ 4.20 GHz
GPU: Intel Iris Xe Graphics @ 1.30 GHz [Integrated]
Memory: 7.34 GiB / 15.36 GiB (48%)
Swap: 2.54 GiB / 16.00 GiB (16%)
Disk (/): 194.54 GiB / 475.92 GiB (41%) - btrfs
Local IP (wlan0): 192.168.179.11/24
Battery (PABAS0241231): 100% [AC Connected]
Locale: en_GB.UTF-8