Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gahjelle/pythonji

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 - Write Python with Emojis

Write Python code using emojis 🐍

Example of running 🐍

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

🐍 is available on PyPI. Install it with pip:

$ python -m pip install pythonji

Using 🐍

🐍 installs as pythonji. 🐍 code files have the suffix .🐍. You can run a 🐍 code file as follows:

$ pythonji file.🐍

Example

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 🐼 🐍 🦁

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 of pythonji.
  • Black unfortunately can not handle 🐍 code. Does anybody want to contribute to ⬛, a formatter for 🐍?

About

🐍 - Write Python with Emojis

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.