Write Python code using emojis 🐍
Marc Garcia gave a wonderful lightning talk at EuroSciPy 2018 in Trento, where he pointed out some obvious deficiencies in Python's handling of unicode. For instance, code like the following is not supported:
🐍 is available on PyPI. Install it with pip
:
$ python -m pip install pythonji
🐍 installs as pythonji
. 🐍 code files have the suffix .🐍
. You can run a 🐍 code file as follows:
Save the following code to the file 🐼.🐍
:
import pandas as 🐼 from numpy import random as 🔀 # Define a dataframe and print it to the console 📋 = 🐼.DataFrame( { "😀": ["🐼", "🐍", "🦁"], "🏷️": ["Panda", "Python", "Lion"], "💯": 🔀.randint(2, 5, size=3), }, ).set_index("😀") print(📋) # Do some arithmetic with the dataframe 🔤 = f" Pythonji {' '.join(📋.index)}" 🔢 = 📋.loc["🐍", "💯"] + 📋.loc["🐼", "💯"] print(🔤 * 🔢)
You can run the code as follows:
$ pythonji 🐼.🐍 🏷 💯 😀 🐼 Panda 2 🐍 Python 2 🦁 Lion 4 Pythonji 🐼 🐍 🦁 Pythonji 🐼 🐍 🦁 Pythonji 🐼 🐍 🦁 Pythonji 🐼 🐍 🦁
pip
does not currently handle unicode command names. Ideally, we want the executable to be named 🐍
instead of pythonji
.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4