14
submitted 2 months ago* (last edited 1 month ago) by bterwijn@programming.dev to c/python@programming.dev

An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:

top 8 comments
sorted by: hot top controversial new old
[-] cheesorist@lemmy.world 6 points 2 months ago
[-] bterwijn@programming.dev 2 points 1 month ago

Nice one, see the "Solution" link for correct answer.

[-] LodeMike@lemmy.today 1 points 2 months ago
[-] bterwijn@programming.dev 2 points 1 month ago

Incorrect sorry, check the "Solution" link for the correct answer.

[-] LodeMike@lemmy.today 1 points 1 month ago

Oh du-duoy. Forgot that list of list is a list of pointers somehow while also remembering a list is a pointer. Thanks.

[-] aev_software@programming.dev 1 points 3 weeks ago

None. That program doesn't output anything. A good compiler would simply delete all the code.

[-] solrize@lemmy.ml -3 points 2 months ago

Preferred solution: learnyouahaskell.com . For immutable data!

[-] bterwijn@programming.dev 1 points 1 month ago

Different languages make different choices. The disadvantage of Haskell is that if you want to change one value in a collection of a million values that it either makes a full copy or tries to optimize by sharing values behind the scene, both resulting in significant overhead. Most people already understand that pure functional programming languages don't deliver except in very specific circumstances: Haskell TIOBE rating 0.32%, https://www.tiobe.com/tiobe-index/

this post was submitted on 14 Nov 2025
14 points (76.9% liked)

Python

7662 readers
43 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS