When I define a class in function that use function's params, throw NameError: name 'x' is not defined.
def foo(x):
class Meta:
x = x
foo(1)
# throw NameError
NameError: name 'x' is not defined
When I define a class in function that use function's params, throw NameError: name 'x' is not defined.
def foo(x):
class Meta:
x = x
foo(1)
# throw NameError
NameError: name 'x' is not defined
Your field x
inside the class is masking the parameter x
from the function.
def foo(x):
class Meta:
y = x
foo(1)
will stop giving you this error.
The question is poorly written (there is not even a question), so I might have misunderstood you.