News for hackers. Stuff that matters.
Re:A practical usage of ChainMap in Python by thedirt0115 on Monday September 24, 2018 @04:27PM (#18061108)
It's nice for anything with nested scopes -- Example that came to mind since a link to Crafting Interpreters was also on the front page: Variable lookup for for an interpreter. If each scope gets its own set of bindings, you can make a ChainMap from most specific to least specific and look up values from that instead of manually traversing scopes.

There are no comments on this comment yet.