• alexdeathway@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    7 months ago

    First one are method name, second one are status name.

    
    def open_file_dialog(self):
           self.dialog_file_open = True
           pass
    
    

    Yoda level preference war.

    • Croquette@sh.itjust.works
      link
      fedilink
      arrow-up
      4
      ·
      7 months ago

      I tend to add is to booleans toreally differentiate between a method name and a status.

      def open_file_dialog(self):
          self.dialog_file_is_open = True
          pass
      

      That way, it’s easier for my dumb brain to spot which is which at a glance.

          • sus@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            edit-2
            7 months ago

            that works for 2 word names eg is_open or is_file, but in this case is_dialog_file_open is structured like a question, while dialog_file_is_open is structured like a statement

            • Rinox@feddit.it
              link
              fedilink
              arrow-up
              2
              ·
              7 months ago

              Doesn’t matter, the point is that, if it starts with “is” then you automatically know it’s a boolean.