An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise4_mg.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model

The โ€œSolutionโ€ link uses ๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†_๐—ด๐—ฟ๐—ฎ๐—ฝ๐—ต to visualize execution and reveals whatโ€™s actually happening.

#Python #programming #memory_graph

Automatic data structure visualization in your IDE using ๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†_๐—ด๐—ฟ๐—ฎ๐—ฝ๐—ต:
- web debugger binary tree demo: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/bin_tree.py&timestep=0.2&play
- setup video for VS Code: https://youtu.be/23_bHcr7hqo

#Python #programming #memory_graph

An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise1.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model

The โ€œSolutionโ€ link uses ๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†_๐—ด๐—ฟ๐—ฎ๐—ฝ๐—ต to visualize execution and reveals whatโ€™s actually happening.

#Python #programming #memory_graph

An exercise to help build the right mental model for Python data. The โ€œSolutionโ€ link uses ๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†_๐—ด๐—ฟ๐—ฎ๐—ฝ๐—ต to visualize execution and reveals whatโ€™s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise2.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model

#Python #programming #memory_graph

Understanding a data structure like linked list in Python is a lot easier when you can just see it. Linked_List demo: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/linked_list.py&timestep=0.2&play

๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†_๐—ด๐—ฟ๐—ฎ๐—ฝ๐—ต visualizes Python objects and references, so data structures stop being abstract and become something you can debug with ease. No more endless print-debugging. No more stepping through 50 frames just to find one sneaky reference/aliasing mistake.

#Python #programming #memory_graph

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:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise7.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model

#Python #Mutability #memory_graph

Teaching data structures in Python gets easier with ๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†_๐—ด๐—ฟ๐—ฎ๐—ฝ๐—ต visualizations. Data structures are no longer abstract concepts but concrete, clear and easy to debug.

Hash_Map demo: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/hash_map.py&timestep=0.2&play

This Hash_Map (Hash_Table) is a Python implementation similar to 'dict'. The demo visualizes:
- adding keyโ€“value pairs
- rehashing
- lookup by key
- iterating over keys

#Python #programming #memory_graph

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:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise16.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model

#Python #programming #memory_graph

Four options for ๐‚๐จ๐ฉ๐ฒ in Python:

๐š’๐š–๐š™๐š˜๐š›๐š ๐šŒ๐š˜๐š™๐šข

๐š๐šŽ๐š ๐šŒ๐šž๐šœ๐š๐š˜๐š–_๐šŒ๐š˜๐š™๐šข(๐šŠ):
... ๐šŒ = ๐šŠ.๐šŒ๐š˜๐š™๐šข()
... ๐šŒ[๐Ÿท] = ๐šŠ[๐Ÿท].๐šŒ๐š˜๐š™๐šข()
... ๐š›๐šŽ๐š๐šž๐š›๐š— ๐šŒ

๐šŠ = [[๐Ÿท, ๐Ÿธ], [๐Ÿน, ๐Ÿบ]]
๐šŒ๐Ÿท = ๐šŠ
๐šŒ๐Ÿธ = ๐šŠ.๐šŒ๐š˜๐š™๐šข()
๐šŒ๐Ÿน = ๐šŒ๐šž๐šœ๐š๐š˜๐š–_๐šŒ๐š˜๐š™๐šข(๐šŠ)
๐šŒ๐Ÿบ = ๐šŒ๐š˜๐š™๐šข.๐š๐šŽ๐šŽ๐š™๐šŒ๐š˜๐š™๐šข(๐šŠ)

c1, ๐š๐ฌ๐ฌ๐ข๐ ๐ง๐ฆ๐ž๐ง๐ญ: nothing is copied, everything is shared
c2, ๐ฌ๐ก๐š๐ฅ๐ฅ๐จ๐ฐ ๐œ๐จ๐ฉ๐ฒ: first value is copied, underlying is shared
c3, ๐œ๐ฎ๐ฌ๐ญ๐จ๐ฆ ๐œ๐จ๐ฉ๐ฒ: you decide what is copied and shared
c4, ๐๐ž๐ž๐ฉ ๐œ๐จ๐ฉ๐ฒ: everything is copied, nothing is shared

see: https://memory-graph.com/#breakpoints=8&continues=1&play

#Python #programming #memory_graph

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:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise15.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model

#Python #programming #memory_graph