Are there any risks/downsides to putting emojis in code?

Viewed 94

I sometimes use emojis in programs to highlight certain parts of the code (in open source libraries). I rarely use more than say 5-6 per script and I find they really stand out due to their colors in a text editor.

Typically, they are transient markers and will be removed when whatever issue they are associated with is closed.

My question is: are emojis liable to cause any issues in the general Python toolchain? This includes, but is not limited to: git, github, pypi, editors, linters, interpreter, CI/CD pipelines, command line usage...

I haven't seen any, but then again I rarely see emojis in code. This is a Python 3 only question, so Python 2 unicode aspects are out.

(This question is not about whether this looks professional or not. That's a valid, but entirely separate consideration.)

Some examples:

# ⚙️ this is where you configure foo
foo.max_cntr = 10
foo.tolerate_duplicates = False

# ‍♂️‍♂️‍♂️ to indicate code to be removed
some dead code

#  very important, don't forget to do this!
bar.deactivate_before_call()

1 Answers

In terms of risks, there aren't really any real ones. If you use them in comments they'll be removed/ignored at runtime anyway so performance-wise there's no issues.

The main issue that you could run into is that some Linux distributions (distros) DONT support emojis, so they'd fallback to some standard unicode character (generically a white rectangle with a cross through the middle), so this could make comments hard to understand.

But in personal use: no not really, there's no issues.

TLDR: Probably not, but maybe.

Related