🐍 - Write Python with Emojis
Write Python code using emojis
Inspiration
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:
import pandas as 🐼
Installation
pip
:
$ python -m pip install pythonji
🐍
Using pythonji
. .🐍
. You can run a
$ pythonji file.🐍
Example
Save the following code to the file 🐼.🐍
:
import pandas as 🐼
# Define a dataframe and print it to the console
🐍 = 🐼.DataFrame(
{
"animal": ["Panda", "Python", "Lion"],
"😀": ["🐼", "🐍", "🦁"],
"number": [1, 2, 3],
},
).set_index("😀")
print(🐍)
# Do some arithmetic with the dataframe
🔤 = f" Pythonji {' '.join(🐍.index)}"
🔢 = 🐍.loc["🐍"].number + 🐍.loc["🐼"].number
print(🔤 * 🔢)
You can run the code as follows:
$ pythonji 🐼.🐍
animal number
😀
🐼 Panda 1
🐍 Python 2
🦁 Lion 3
Pythonji 🐼 🐍 🦁 Pythonji 🐼 🐍 🦁 Pythonji 🐼 🐍 🦁
Limitations
-
🐍 currently only handles single script files. It can import any regular Python module, but unfortunately not🐍 modules. - Sadly,
pip
does not currently handle unicode command names. Ideally, we want the executable to be named🐍
instead ofpythonji
. -
Black unfortunately can not handle
🐍 code. Does anybody want to contribute to ⬛, a formatter for🐍 ?