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
  • 11,665
  • 7
  • 38
  • 61

0 Answers0