py/lexer: Add support for underscores in numeric literals.

This is a very convenient feature introduced in Python 3.6 by PEP 515.
This commit is contained in:
Damien George
2018-06-02 00:21:46 +10:00
parent b2fa1b50ed
commit 6a445b60fa
6 changed files with 36 additions and 0 deletions

10
tests/float/python36.py Normal file
View File

@@ -0,0 +1,10 @@
# tests for things that only Python 3.6 supports, needing floats
# underscores in numeric literals
print(1_000.1_8)
print('%.2g' % 1e1_2)
# underscore supported by int/float constructors
print(float('1_2_3'))
print(float('1_2_3.4'))
print('%.2g' % float('1e1_3'))