So, I was programming in the IDE Spyder, and typed in import a
by accident (I meant to type import math
). Anyways, it threw up this XKCD page.
At first I was a bit baffled and then got concerned. After doing some digging, it turns out if you run the code import antigravity
it opens that very page (and this command is actually referenced on that page). I guess this is just some sort of funny easter egg.
But you can imagine, just typing in import a
, not knowing anything about this easter egg and getting a random webpage thrown up threw me off.
You can replicate this very easily. Close the Spyder program, open it up, type in import a
and it'll automatically throw up that webpage. It doesn't do it after if you retype it, you have to have just opened up the program.
What's going on in the background? Is Spyder automatically loading in all the possible modules that begin with a
or something?
So, I was programming in the IDE Spyder, and typed in import a
by accident (I meant to type import math
). Anyways, it threw up this XKCD page.
At first I was a bit baffled and then got concerned. After doing some digging, it turns out if you run the code import antigravity
it opens that very page (and this command is actually referenced on that page). I guess this is just some sort of funny easter egg.
But you can imagine, just typing in import a
, not knowing anything about this easter egg and getting a random webpage thrown up threw me off.
You can replicate this very easily. Close the Spyder program, open it up, type in import a
and it'll automatically throw up that webpage. It doesn't do it after if you retype it, you have to have just opened up the program.
What's going on in the background? Is Spyder automatically loading in all the possible modules that begin with a
or something?
- 2 You're right about the easter egg. There are several in Python. – Friedrich Commented Mar 25 at 13:49
- The reason it doesn't work a second time is that modules are cached by Python. The second import doesn't load it again, it just gives you another reference to the same module. – Mark Ransom Commented Mar 25 at 14:13
1 Answer
Reset to default 0I think the only way this could happen is if you have a module a
in your path somewhere, and it does an import antigravity
somewhere within it. It seems unlikely but it's the only explanation that fits.