I tried to execute the following code on a Python IDLE

from __future__ import braces 

And I got the following error:

SyntaxError: not a chance

What does the above error mean?

wovano's user avatar

wovano

5,1885 gold badges33 silver badges58 bronze badges

asked Jul 23, 2013 at 13:38

Anurag-Sharma's user avatar

0

You have found an easter egg in Python. It is a joke.

It means that delimiting blocks by braces instead of indentation will never be implemented.

Normally, imports from the special __future__ module enable features that are backwards-incompatible, such as the print() function, or true division.

So the line from __future__ import braces is taken to mean you want to enable the 'create blocks with braces' feature, and the exception tells you your chances of that ever happening are nil.

You can add that to the long list of in-jokes included in Python, just like import __hello__, import this and import antigravity. The Python developers have a well-developed sense of humour!

answered Jul 23, 2013 at 13:38

Martijn Pieters's user avatar

10 Comments

For folks puzzled by "not a chance", which is slang, it means that there is no possibility or probability of the thing happening.

@chepner Less Whitespace, More Enterprise :D Thanks!

It's less funny for blind people trying to deal with Python on a screen reader. For them the reliance on white-space for blocks makes reading and writing code difficult. At least that's been my experience working with blind kids.

@dumbledad: Haskell, CoffeeScript, Miranda, Occam, and F# all use whitespace in the syntax. Note: this comment thread is getting way out of hand; please join the Python chat room if you want to discuss further.

The __future__ module is normally used to provide features from future versions of Python.

This is an easter egg that summarizes its developers' feelings on this issue.

There are several more:

import this will display the zen of Python.

import __hello__ will display Hello World....

In Python 2.7 and 3.0, import antigravity will open the browser to a comic!

answered Jul 23, 2013 at 13:41

zhangyangyu's user avatar

Comments

It means that writing Python code like:

def hello() {
    print("Hello");
    print("World");
}

instead of

def hello():
    print("Hello")
    print("World")

will never happen. One is both faster to type and easier to understand. Can you tell which one?

Oh, and someone made this.

answered Aug 29, 2022 at 11:34

roundabout's user avatar

1 Comment

Re "someone made this": That was published on 1st April.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.