The class namespace (material defined directly in the class) is not accessible from the functions defined in this namespace. Lambda is just a function, so this applies to lambdas. Your CallableKlass is a red herring. In this simpler case, the behavior is the same:
>>> class Foo(object): ... d = {'foo': 'bar'} ... (lambda stuff: d[stuff])('foo') Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> class Foo(object): File "<pyshell#3>", line 3, in Foo (lambda stuff: d[stuff])('foo') File "<pyshell#3>", line 3, in <lambda> (lambda stuff: d[stuff])('foo') NameError: global name 'd' is not defined >>> class Foo(object): ... d = {'foo': 'bar'} ... def f(stuff): ... d[stuff] ... f('foo') Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> class Foo(object): File "<pyshell#4>", line 5, in Foo f('foo') File "<pyshell#4>", line 4, in f d[stuff] NameError: global name 'd' is not defined
source share