class ClassName:
        def __init__(self, attribute):
          self.attribute = attribute
        def __eq__(self, other):
          if isinstance(other, ClassName):
            return self.attribute == other.attribute
          return False
      
      Python language logo

      Create class with equal operator

      Python public recipes

      Shortcut: class.new_with_eq

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.