The Python Oracle

Syntax Error: Not a Chance - What is this error?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Quiet Intelligence

--

Chapters
00:00 Syntax Error: Not A Chance - What Is This Error?
00:19 Accepted Answer Score 228
01:07 Answer 2 Score 40
01:34 Answer 3 Score 2
01:57 Thank you

--

Full question
https://stackoverflow.com/questions/1781...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #syntaxerror #curlybraces

#avk47



ACCEPTED ANSWER

Score 228


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!




ANSWER 2

Score 40


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!




ANSWER 3

Score 2


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.