Hacker News new | ask | show | jobs
by PhilipTrauner 1479 days ago

  0_0  # Python >= 3.6 is required
(https://github.com/jwilk/abmagick/blob/8959fe7c390283d095e42...)

Highly cursed, yet wildly creative way of asserting the language version.

Support for underscores in numeric literals landed in 3.6 (PEP-515), < 3.6 chokes on the underscore and raises a syntax error instead.

3 comments

See also related:

"What the fuck Python?"

https://github.com/satwikkansal/wtfpython

Along with the corresponding HN discussion:

https://news.ycombinator.com/item?id=31566031 (450 points, 153 comments)

See https://github.com/jwilk/python-syntax-errors if you need curses for other Python versions.
Can't help but feel that this approach might not be that cursed after all, seeing how you actually went through the effort of automatically testing all of these.

Nothing beats this guy though: 0_0

The first time I read this, I thought you were making a wide-eyed emoticon about the fact that it requires Python 3.6