home.social

#mutability — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #mutability, aggregated by home.social.

  1. 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: memory-graph.com/#codeurl=http
    - Explanation: github.com/bterwijn/memory_gra

  2. As much as I value data integrity, I also appreciate data mutability. I’ve never understood the crowd that insists there's only one best solution.

    #mutability #dataprivacy #dataintegrity

  3. @matt

    Oh, and sets too.

    Example with shallow list copy and an embedded mutable object (another list):

    >>> a = [1, 2, [3, 4]]
    >>> b = a.copy()

    >>> b
    [1, 2, [3, 4]]
    >>> b[0] = 5
    >>> b
    [5, 2, [3, 4]]

    >>> a
    [1, 2, [3, 4]]

    >>> b[2][0] = 8
    >>> a
    [1, 2, [8, 4]]
    >>> b
    [5, 2, [8, 4]]

    #mutability #copy #WhoTouchedMy