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:
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:
8 Comments
cheesorist@lemmy.world · 6 pts · 275d
id say B
bterwijn@programming.dev · 2 pts · 269d
Nice one, see the "Solution" link for correct answer.
aev_software@programming.dev · 1 pts · 236d
aev_software@programming.dev · 1 pts · 236d
Nope I spoke too soon. My bad.
LodeMike@lemmy.today · 1 pts · 275d
A
bterwijn@programming.dev · 2 pts · 273d
Incorrect sorry, check the "Solution" link for the correct answer.
LodeMike@lemmy.today · 1 pts · 273d
Oh du-duoy. Forgot that list of list is a list of pointers somehow while also remembering a list is a pointer. Thanks.
solrize@lemmy.ml · -3 pts · 275d
Preferred solution: learnyouahaskell.com . For immutable data!
bterwijn@programming.dev · 1 pts · 273d
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/