Self referential equasion

a = lambda x: True if all(x) else False

I have function “a” here representing the best possible solution

How can I check whether “a” is the best possible solution itself? (as opposed to that in general?)

v = a

Obviously this refers to what a refers to, which isn’t a

I figured out to use attributes

  class m:
        def __init__(self, a):
            self.a = a

now I have a new variable to work with!

FYI the if is not required. Just use all(x) as it return a boolean result. See Built-in Functions — Python 3.12.4 documentation