MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / __missing__

Method __missing__

example_code/item_028.py:182–185  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

180
181class Pictures(dict):
182 def __missing__(self, key):
183 value = open_picture(key)
184 self[key] = value
185 return value
186
187pictures = Pictures()
188handle = pictures[path]

Callers

nothing calls this directly

Calls 1

open_pictureFunction · 0.85

Tested by

no test coverage detected