Is the unicode string valid in a Python 3 identifier.
(i)
| 46 | print('Filtering out characters that are not valid Python 3 identifiers') |
| 47 | |
| 48 | def test_ident(i): |
| 49 | """Is the unicode string valid in a Python 3 identifier.""" |
| 50 | # Some characters are not valid at the start of a name, but we still want to |
| 51 | # include them. So prefix with 'a', which is valid at the start. |
| 52 | return ('a' + i).isidentifier() |
| 53 | |
| 54 | assert test_ident("α") |
| 55 | assert not test_ident('‴') |