MCPcopy
hub / github.com/fluentpython/example-code-2e / __init__

Method __init__

18-with-match/lispy/original/lispy.py:124–133  ·  view source on GitHub ↗
(self, parms=(), args=(), outer=None)

Source from the content-addressed store, hash-verified

122class Env(dict):
123 "An environment: a dict of {'var':val} pairs, with an outer Env."
124 def __init__(self, parms=(), args=(), outer=None):
125 # Bind parm list to corresponding args, or single parm to list of args
126 self.outer = outer
127 if isa(parms, Symbol):
128 self.update({parms:list(args)})
129 else:
130 if len(args) != len(parms):
131 raise TypeError('expected %s, given %s, '
132 % (to_string(parms), to_string(args)))
133 self.update(zip(parms,args))
134 def find(self, var):
135 "Find the innermost Env where var appears."
136 if var in self: return self

Callers

nothing calls this directly

Calls 2

to_stringFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected