Skip to content

Instantly share code, notes, and snippets.

@emsi
Last active June 18, 2019 10:16

Revisions

  1. emsi revised this gist Jun 18, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion update.py
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,7 @@ def update(d1, d2):
    return dict(d1, **d2)

    def update2(d1, d2):
    return (lambda d: d.update(d2) or d)(d1)
    return (lambda d: d.update(d2) or d)(d1)

    def remove(d, k):
    return d.__delitem__(k) or d
  2. emsi renamed this gist Jun 18, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. emsi created this gist Jun 18, 2019.
    8 changes: 8 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    d1={1:1, 2:2, 3:3}
    d2={3:4, 5:6, 7:8}

    def update(d1, d2):
    return dict(d1, **d2)

    def update2(d1, d2):
    return (lambda d: d.update(d2) or d)(d1)