How Memes can help you learn Python

Susanne van Wagensveld
4 min readJan 8, 2021

--

Memes are everywhere. But they aren’t only fun and jokes! They can teach you some fundamental concepts and the spirit of python found in the PEPs (Python Enhancement Proposals).

And of course, there have to be snakes in here somewhere.

Syntax

Whether you are learning python as your first language or as an experienced programmer, you’ll notice some things that make python unique.

Semicolons and Braces

For example, you’ll notice all the stuff you DON’T have to use, most notably semicolons and braces:

But still. The compiler has to know what is what. Everything comes with a price. And with python, that price is measured in indentation errors.

It is what it is.

Indentation

And there we have it: a perfectly good reason to make fun of python for camp “I’d rather use semicolons and braces”. And the memes are full of it.

But why spaces? Can’t I just use tabs like I always have? Yes. But. PEP8 defines the Style Guide for Python Code. It strongly recommends spaces over tabs:

Spaces are the preferred indentation method.

Tabs should be used solely to remain consistent with code that is already indented with tabs.

Python 3 disallows mixing the use of tabs and spaces for indentation.

Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively.

When invoking the Python 2 command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended!

While tabs aren’t forbidden, spaces are recommended for new code. Just make sure you don’t mix the two!

Truths

Then there is something that annoys every new python programmer: true isn’t true. Only True™ is true.

It’s True.

And while it is really annoying the first 3 or 37 times, annoying things make great memes. Common pain and laughter will always unite people all over the world.

But why does Python use “True” instead of “true”? We can find the answer in the Python Enhancement Proposal for Bool Types.

Should the constants be called ‘True’ and ‘False’ (similar to None) or ‘true’ and ‘false’ (as in C++, Java and C99)?

=> True and False.

Most reviewers agree that consistency within Python is more important than consistency with other languages.

As it turns out, earlier versions of Python didn’t have a bool type and used 0 or 1 instead. But Python had already set a precedent for naming built-in constants with the None constant. Having to chose between a rock and a hard place, most reviewers agreed in favor of consistency within Python.

Brevity and Neat Tricks

Python is famous for the ability to do a whole in just a few lines of code.

from universe import kill

And every uniqueness can be made into a meme.

What is your favorite one-liner?

Maybe you use the methods mentioned all the time, but especially for beginners, it is helpful to see what the community thinks of the most elegant way to a certain thing. Especially if you have been corrupted by other languages and would never think about a shorter way of doing things.

The Awesome Python Community

As it’s custom with (almost) every language: There are hardcore and loyal python fans who love coding in python. And yes, that comes with some shade towards other languages. But in the end, we’re all programmers.

Python is the best, I read that on the internet.

I have got to know the python community as an open and fun group of people who love to share knowledge. The events from different python user groups have always been fun and interesting, even as a programming beginner. So don’t be hesitant, find out when the next Python user group is gathering and get in touch with the community. In a lot of cities, there are even PyLadies-Chapters focused on helping more women become active participants and leaders in the Python open-source community.

See you at the next MeetUp!

--

--