Python Syntax and Semantics - Easter Eggs

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,
    You’ll be the grandest lady in the Easter parade.
    Irving Berlin (1888–1989)

    One of our defects as a nation is a tendency to use what have been called “weasel words.” When a weasel sucks eggs the meat is sucked out of the egg. If you use a “weasel word” after another there is nothing left of the other.
    Theodore Roosevelt (1858–1919)