I have this sample python 3 code:
class C: a = lambda x: x+1 b = lambda y: a(y)*2 The class definition happens without any error. But when I attempt to call a class property b (which in turn tries to access a fellow class property a) I get an error:
C.b(1) NameError: name 'a' is not defined How can I reference class variables when defining other class variables?
b = lambda y: C.a(y)*2C.a()b/c my IDE kept red-lining it by sayingUndefined variable 'C'. Thanks!