>>> from __future__ import braces File " ", line 1 SyntaxError: not a chance For those interested in how this (hilarious) error text came to be, it's been hardcoded in cpython since 2001! https://github.com/python/cpython/commit/ad3d3f2f3f19833f59f... The author, Jeremy Hylton, is now a Principal Engineer at Google working on AI search quality. It's quite remarkable that in 24 years, a single person's career has gone…
Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.
Python’s Preprocessor
61–70 of 109 posts
Re: Python’s Preprocessor
#62>>> from __future__ import braces File " ", line 1 SyntaxError: not a chance For those interested in how this (hilarious) error text came to be, it's been hardcoded in cpython since 2001! https://github.com/python/cpython/commit/ad3d3f2f3f19833f59f... The author, Jeremy Hylton, is now a Principal Engineer at Google working on AI search quality. It's quite remarkable that in 24 years, a single person's career has gone…
Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.
Is this real?
Re: Python’s Preprocessor
#63Earlier quoted context omitted.
Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.
> `break rust;` causing the Rust compiler to emit an internal compiler error Is this real?
> error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?
> --> src/main.rs:2:5
> |
> 2 | break rust;
> | ^^^^^^^^^^
> |
> = note: the compiler expectedly panicked. this is a feature.
> = note: we would appreciate a joke overview: https://github.com/rust-lang/rust/issues/43162#issuecomment-...
Re: Python’s Preprocessor
#64Earlier quoted context omitted.
Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.
> `break rust;` causing the Rust compiler to emit an internal compiler error Is this real?
Re: Python’s Preprocessor
#65Earlier quoted context omitted.
> `break rust;` causing the Rust compiler to emit an internal compiler error Is this real?
Yes https://play.rust-lang.org/?version=stable&mode=debug&editio...
Lovely, and the word game is just great.
Re: Python’s Preprocessor
#66Re: Python’s Preprocessor
#67Now, I'm left to wonder if this could have been used to better handle the Python 2-to-3 transition, e.g '# coding: six.python2' would adjust Python2 code to be valid Python3, or '# coding: six.python3' would adjust Python3 code to run under Python2 - e.g adding/removing the b"..." or u"..." prefixes!
Re: Python’s Preprocessor
#68> the Python developers have strong opinions except when it comes to downloading, installing, or running anything Python related. maybe by 2124 we can give users a python app and let them run it without 20 steps. (oh who am i kidding, by then we'll rewrite everything in whatever comes after Rust)
Re: Python’s Preprocessor
#69That's quite interesting. Now, I'm left to wonder if this could have been used to better handle the Python 2-to-3 transition, e.g '# coding: six.python2' would adjust Python2 code to be valid Python3, or '# coding: six.python3' would adjust Python3 code to run under Python2 - e.g adding/removing the b"..." or u"..." prefixes!
Some more nasty changes: various built ins like .keys() and .values() return lists in py2 but iterators in py3. Code gets very verbose if you use the six utilities or other workarounds to translate code safely - most times those are called they are used once, but every once in a while they are used twice.
Imo if you have such a tool that can rewrite at import time you should just commit the transformed code, and clean it up incrementally. The hard parts are the behavior changes that can cross long distances like the str v bytes behaving so different than py2 Unicode v str
Re: Python’s Preprocessor
#70>>> from __future__ import braces File " ", line 1 SyntaxError: not a chance For those interested in how this (hilarious) error text came to be, it's been hardcoded in cpython since 2001! https://github.com/python/cpython/commit/ad3d3f2f3f19833f59f... The author, Jeremy Hylton, is now a Principal Engineer at Google working on AI search quality. It's quite remarkable that in 24 years, a single person's career has gone…
Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.
``` import Data.Function
main = do let it = fix error print it ```