From 6a445b60fad87c94a1d00ce3a043b881a1f7a5a4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 2 Jun 2018 00:21:46 +1000 Subject: py/lexer: Add support for underscores in numeric literals. This is a very convenient feature introduced in Python 3.6 by PEP 515. --- tests/basics/python36.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/basics/python36.py (limited to 'tests/basics/python36.py') diff --git a/tests/basics/python36.py b/tests/basics/python36.py new file mode 100644 index 000000000..20ecd9227 --- /dev/null +++ b/tests/basics/python36.py @@ -0,0 +1,10 @@ +# tests for things that only Python 3.6 supports + +# underscores in numeric literals +print(100_000) +print(0b1010_0101) +print(0xff_ff) + +# underscore supported by int constructor +print(int('1_2_3')) +print(int('0o1_2_3', 8)) -- cgit v1.2.3