Skip to main content

๐Ÿ - Write Python with Emojis

Project description

๐Ÿ - 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

๐Ÿ 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 ๐Ÿผ

# 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 of pythonji.
  • Black unfortunately can not handle ๐Ÿ code. Does anybody want to contribute to โฌ›, a formatter for ๐Ÿ?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythonji-0.1.1.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

pythonji-0.1.1-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page