0

When I define the class C as follows:

class C:
  a = [0,1,2]
  m = dict([(i, a[i]) for i in a])

it generates the following error:

NameError: name 'a' is not defined

I tried to replace a with C.a but it says:

NameError: name 'C' is not defined

Any idea is appreciated

sophros
  • 14,672
  • 11
  • 46
  • 75

0 Answers0