The Core Objects of Python

Joseph Mellor
12 min readFeb 9, 2023

Python has a lot of objects, but all of them are made from a few fundamental types. If you understand those, you’ll understand Python.

Image made by me using the python logo, cool-retro-term, the python interpreter, my terminal color scheme, and GIMP.

In the previous article, we set ourselves up to write python, but we didn’t do anything with it besides print “Hello, World!”. In this article, we’re going to talk about how to actually do things in python. We’re also going to work with the python interpreter.

If you haven’t read the first article yet, I would strongly suggest reading it so that you have python set up and you’ll understand my conventions like why I keep switching between a Linux terminal and a MacOS terminal.

Quick Note

I accidentally published this story while trying to schedule its publication, so I decided to also publish the first story.

Topics Covered

I don’t want to waste your time, so here’s a list of topics covered. If you understand these topics, feel free to skip this article (and maybe read one of my other articles).

  • How python Handles Statements
  • Experimenting with the Python Interpreter
  • Objects
  • Numbers: (integer and floating point)
  • Lists: (arrays, vectors, etc.)
  • Strings: (text)
  • Tuples: (immutable ordered lists)
  • Dictionaries: (hash tables, unordered maps, associative arrays, etc.)

How python Handles Statements

Since How python Handles Statements is a short but necessary topic, I’m including it within this article instead of putting it in its own article. python will read your statements from top to bottom in the file.

Statements End at the End of the Line

Unlike languages like C, C++, and Java, statements in python end when the line ends. Furthermore, instead of using curly braces, python uses indentation and a colon to indicate which statements are grouped together. For comparison, statements in C, C++, and Java look like

--

--

Joseph Mellor

BS in Physics, Math, and CS with a minor in High-Performance Computing. You can find all my articles at https://josephmellor.xyz/articles/.