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. In Python 2.7, instead of Hello world!
it prints Hello world...
.
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.
The statement "from __future__ import barry_as_FLUFL" is named after Barry Warsaw and replaces the != operator with the <> operator.
Read more about this topic: Python Syntax And Semantics
Famous quotes containing the words easter and/or eggs:
“In your Easter bonnet, with all the frills upon it,
Youll be the grandest lady in the Easter parade.”
—Irving Berlin (18881989)
“The common cormorant or shag
Lays eggs inside a paper bag.”
—Christopher Isherwood (19041986)