think I've stumbled upon a weird bug in python and it goes like this:
class Foo:
def __init__(self):
print(eval('self.example(lambda: self.pass_me("example"))'))
def example(self, func):
return func()
def pass_me(self, arg1):
print(arg1)
running this class will return a: NameError: name 'self' is not defined.
However running it without the eval will work perfectly:
class Foo:
def __init__(self):
print(self.example(lambda: self.pass_me("example")))
def example(self, func):
return func()
def pass_me(self, arg1):
print(arg1)
anyone know if this is actually a bug or if I'm overlooking something?
and since bug discussions tend to diverge into chaos be polite in the answers we are all here to learn