Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 577 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 577 Bytes

learn.py

Code and Notes for Python Language.


Utilities


  • AttrDict: a mapping that allows attribute-style access, key-style access, and double star ** unpacking.

    • Usage:
      from dictionary import AttrDict
      
      d = AttrDict(a = 1, b = 2)
      assert d.a == d['a']
  • Show: Compactly display the structure of an arbitrary object, like a dict, a list, etc.

    • Usage:
      from structure import Show
      
      x = {i: list(range(100)) for i in range(100)}
      show = Show(max_len=10, indent='..')
      show(x)