mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-25 12:34:23 +01:00
Brace yourself: Add to explanation
Resolves https://github.com/satwikkansal/wtfpython/issues/114
This commit is contained in:
parent
2bfa6d2e5b
commit
80a969a556
6
README.md
vendored
6
README.md
vendored
@ -2148,11 +2148,13 @@ from __future__ import braces
|
|||||||
SyntaxError: not a chance
|
SyntaxError: not a chance
|
||||||
```
|
```
|
||||||
|
|
||||||
Braces? No way! If you think that's disappointing, use Java.
|
Braces? No way! If you think that's disappointing, use Java. Okay, another surprising thing, can you find where's the `SyntaxError` raised in `__future__` module [code](https://github.com/python/cpython/blob/master/Lib/__future__.py)?
|
||||||
|
|
||||||
#### 💡 Explanation:
|
#### 💡 Explanation:
|
||||||
+ The `__future__` module is normally used to provide features from future versions of Python. The "future" here is however ironic.
|
+ The `__future__` module is normally used to provide features from future versions of Python. The "future" in this specific context is however ironic.
|
||||||
+ This is an easter egg concerned with the community's feelings on this issue.
|
+ This is an easter egg concerned with the community's feelings on this issue.
|
||||||
|
+ The code is actually present [here](https://github.com/python/cpython/blob/025eb98dc0c1dc27404df6c544fc2944e0fa9f3a/Python/future.c#L49) in `future.c` file.
|
||||||
|
+ When the CPython compiler encounters a [future statement](https://docs.python.org/3.3/reference/simple_stmts.html#future-statements), it first runs the appropriate code in `future.c` before treating it as a normal import statement.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user