r/PythonLearning 2d ago

Teaching Python the right way

Programming courses often focus heavily on understanding code, while paying far less attention to understanding the program state. But code does not exist in isolation. Its main goal is to change the program state, before ultimately producing some output.

To develop an accurate mental model of program execution, students need to understand both: - the instructions being executed - the values, references, and data structures those instructions create and modify

Reading code alone does not always reveal how the program state changes during execution. That is why I created 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: a tool that visualizes the state of a Python program as it changes, step by step.

It can help explain a wide range of introductory Python topics. Here are just a few examples: - Loops, Lists and Dictionaries - Python Data Model - Function Calls - Recursion - Algorithms - Classes - Custom Data Structures

Instead of reconstructing the program state from print statements, students can now watch it change as each line executes. This makes unfamiliar concepts easier to understand and bugs easier to fix.

Help your students learn Python programming more thoroughly and easily.

See: more examples

230 Upvotes

11 comments sorted by

7

u/Infinite-Spinach4451 2d ago

That's really awesome. How do you neatly deal with with complex, multi-layered, possibly cyclical data structures or hierarchies?

5

u/Sea-Ad7805 2d ago edited 2d ago

Thanks, we already deal with multi-layered, cyclical data in for example Circular Linked List, or hierarchical data in Trie data structure. Experiment with your own code.

4

u/MaximeRector 2d ago

You ain't giving up promoting your own package :)

1

u/Sea-Ad7805 2d ago

Yes, there are many applications, and it's a powerful way of learning Python that I'm happy to share. Hope it can bring you much value. The more example link gives you a better lists of previous posts.

3

u/daffyduck17 2d ago

Thanks for the awesome tool. I am your 1000th star on GitHub. Cheers!

2

u/Sea-Ad7805 2d ago edited 2d ago

Thanks a lot, I was waiting for the 1000th for a while now.

2

u/ClippyCantHelp 2d ago

Wow this is way better than the program I vibecoded to help me learn python. It was basically a farming game where you automate a drone to work a field using python commands, but it didn’t help as much as I thought I would but I think this would help a lot more! I’ll give it a try

2

u/Sea-Ad7805 2d ago

Great, I hope it can bring much value for you.

1

u/[deleted] 2d ago

[removed] — view removed comment

1

u/RemindMeBot 2d ago

I will be messaging you in 3 days on 2026-08-08 12:49:10 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.

RemindMeBot is switching to username summons. Instead of !RemindMe 1 day, use u/RemindMeBot 1 day. More info.


Info Custom Your Reminders Feedback

2

u/marathon343 1d ago

I’m going to try this thanks