Easter Eggs
Users of curly bracket programming languages, such as C or Java, sometimes expect or wish Python to follow a block-delimiter convention. Brace-delimited block syntax has been repeatedly requested, and consistently rejected by core developers. The Python interpreter contains an easter egg that summarizes its developers' feelings on this issue. The code from __future__ import braces
raises the exception SyntaxError: not a chance
. The __future__
module is normally used to provide features from future versions of Python.
Another hidden message, The Zen of Python (a summary of Python philosophy), is displayed when trying to import this
.
The message Hello world...
is printed when the import statement import __hello__
is used.
An antigravity
module was added to Python 2.7 and 3.0. Importing it opens a web browser to an xkcd comic that portrays a humorous fictional use for such a module, intended to demonstrate the ease with which Python modules enable additional functionality.
Read more about this topic: EAFP
Famous quotes containing the words easter and/or eggs:
“Why wont they let a year die without bringing in a new one on the instant, cant they use birth control on time? I want an interregnum. The stupid years patter on with unrelenting feet, never stoppingrising to little monotonous peaks in our imaginations at festivals like New Years and Easter and ChristmasBut, goodness, why need they do it?”
—John Dos Passos (18961970)
“The common cormorant or shag
Lays eggs inside a paper bag.”
—Christopher Isherwood (19041986)