paint-brush
Encoding the Python Source Code Fileby@kshitij10496
11,904 reads
11,904 reads

Encoding the Python Source Code File

by Kshitij Saraogi3mAugust 30th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

There are about <a href="https://github.com/search?l=Python&amp;q=coding&amp;type=Code&amp;utf8=%E2%9C%93" target="_blank">15 million</a> lines of Python code starting with a variant of the form: <code class="markup--code markup--p-code"># -*- coding:&lt;some encoding&gt; -*-</code>hosted on GitHub. To any person learning Python, this might seem as another single-line “comment”. It sure did look that way to me when I started out programming in Python. However, I soon realized that there is something mysterious and esoteric about it. It was some kind of <strong><em>special comment</em></strong> which was being used by every Python developer across codebases. In this article, I will try to break down the concepts behind this line of code.

Company Mentioned

Mention Thumbnail
featured image - Encoding the Python Source Code File
Kshitij Saraogi HackerNoon profile picture
Kshitij Saraogi

Kshitij Saraogi

@kshitij10496

Crafting Engineered Software

Learn More
LEARN MORE ABOUT @KSHITIJ10496'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Kshitij Saraogi HackerNoon profile picture
Kshitij Saraogi@kshitij10496
Crafting Engineered Software

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite