Blogs about Python

  • Created by Stephen Gruppetta
  • Created on 25 Sep 21
  • 10 Highlights
Wrote a Blog Post
Wrote about Python
Wrote an article
+ 1
Many years ago, languages such as Latin and Greek didn't have punctuation marks or spaces between words—scriptio continua. Over time, the need to make the text more readable became important. Punctuation was one of the tools that made its way into languages to help with this.   This made the text easier to read. But it also ensured that the author’s thoughts and ideas were conveyed more precisely.   Computer programming has gone through a similar transformation recently, with the emphasis on readability becoming ever more important. Python is a language that has readability built into its DNA.

Read the latest blog post: 

Python Readability, the PEP 8 Style Guide, and Learning Latin

 
Wrote about Python
Wrote an article
Wrote a Blog Post
+ 1
Published the latest article describing simulation of orbiting planets in a solar system using Python.

The article goes through the steps needed to simulate how bodies in a solar system move based on the gravitational force between the bodies.

Classes are defined which can then be used to create any solar system. An example of a binary star system is shown in the article along with a more classic single star system.

Hope you enjoy it. There's also a GitHub repo with the code (link in article)
Wrote a Blog Post
Wrote about Python
—You’ve written a Python script or project with several modules
—You press Run, figuratively or literally
—What happens behind the scenes in the microseconds or seconds or minutes it takes for your program to run?

You can dive into the details about the internal functioning of Python to learn how a Python program works.
But...there’s another way to visualise what’s happening.

Each blank Python file you create is represented by a room that’s mostly empty except for a few shelves on one of the walls and a small booklet named “built-in”. This booklet has some functions, constants, and other keywords in it.

Monty is a friendly, hard-working character who represents the computer program. He’s very fast and efficient, but you’ll need to spell out instructions clearly when you ask him to do something.

When you ask Monty to create a variable to store some information in, he’ll get an empty box and label it with the variable name you tell him. He’ll place whatever data you want in the box and place the box on one of the shelves.

If you’ve used an import statement, Monty will leave the room briefly to go to the library, where he’ll fetch a book with the name of the module you’re importing. He’ll take this book back to the room and place it on a shelf.

When you use any name in your script, Monty will look around the room to find that name. It may be a book (a module you’ve imported), it may be a box (a variable you’ve created), or it may be a name that’s inside the “built-in” booklet.

A function is a mini-program and is represented by a separate room—the function room—adjacent to the main room.

The door leading from the main room to the function room has a label on it. The name on this label is the function name.

When you call a function in your program, Monty will find the name of the function on the function room’s door. He’ll open the door and go through it. He may need to take some things with him as he goes to the function room. These are the arguments in the function call.

Monty performs all the tasks he’s asked to do in the Function Room and then returns to the main room, possibly bringing some information along with him. These are the items of data returned by the function.

Want to read more? This is the analogy I've developed to help me understand what's really happening "behind the scenes" when a computer program runs. You can read the full analogy here: Understanding How a Python Program Works
Wrote a Blog Post
Published my latest article on using object-oriented programming in Python to simulate bouncing balls

A different take on an OOP example
Wrote a Blog Post
Wrote code
Wrote Python
Wrote about Python
+ 2
Published a long-form post/article on my blog on:

How to Create Any Image Using Only Sine Functions | 2D Fourier Transform in Python


This takes me back to a "previous life" when dealing with optics, and Fourier Optics, in particular, was my day job. I had written a version of this code well over a decade ago when I was diving deeper into Fourier Optics, and it was great to revisit the code–I actually wrote the whole thing from scratch as the old code was in Matlab and written by a much younger version of me!

It was so much fun writing it up into an article too. Hope you enjoy it. 

Wrote a Blog Post
You know how to use Python functions. But do you *really* understand Python functions?

Here's how to visualise what's happening behind the scenes when you define and use Python functions.
Wrote a Blog Post
Wrote a simulation
Wrote code
Published a blog post
+ 2
Simulating the real world in Python helps understand both Python and the real world better.

In this week's blog post, I look at how to simulate a Bouncing Ball in Python, using the simple yet useful turtle module, and only the most basic of physics knowledge.

Wrote a Blog Post
Wrote about Python
To learn Python coding, it's not enough to learn the commands and various tools. You need to be able to see the big picture, understand the story of a computer program.

I just published my latest blog post which introduces The White Room analogy to visualise what's happening behind the scenes when a computer program runs.
Loading...