ENH: 🐍 snake by tacaswell · Pull Request #1686 · python/cpython (original) (raw)

Special case the identifier validation to allow 🐍 to be used in
identifiers


This works in the terminal (assuming you have the right fonts, showing both with and without mark up as the 🐍 do not render for me in the escaped code)

(bleeding) ✔ ~                                                                                                    
18:38 $ python
Python 3.7.0a0 (heads/enh_🐍_snek:2bfe3d18dad, May 20 2017, 18:32:35)                                             
[GCC 6.3.1 20170306] on linux                                                                                     
Type "help", "copyright", "credits" or "license" for more information.                                            
>>> 🐍 = 1
>>> 🐍 + 🐍 
2                                                                                                                 
>>>                                                                                                               
(bleeding) ✔ ~  

(bleeding) ✔ ~
18:38 $ python
Python 3.7.0a0 (heads/enh_🐍_snek:2bfe3d18dad, May 20 2017, 18:32:35)
[GCC 6.3.1 20170306] on linux
Type "help", "copyright", "credits" or "license" for more information.

🐍 = 1
🐍 + 🐍
2

(bleeding) ✔ ~

tsn


It also works in the jupyter notebook (again assuming you have the right fonts)

sn