• alexdeathway@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year 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
      2
      ·
      1 year 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.

  • Agent641@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I just name my variables a, b, c etc. If I have more than 26 variables in any given function, I name them aa, ab, ac, etc.

  • redcalcium@lemmy.institute
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I’m truly torn with this. The first one seems sensible (action -> target) and easier to read and reason about (especially with long names), while the other one looks more organized, naturally sortable and works great with any autocompletion system.

  • rekabis@lemmy.ca
    link
    fedilink
    arrow-up
    0
    arrow-down
    1
    ·
    1 year ago

    There is a reason why little endian is preferred in virtually 100% of cases: sorting. Mentally or lexicographically, having the most important piece of information first will allow the correct item be found the fastest, or allow it to be discounted/ignored the quickest.

    • deadbeef79000@lemmy.nz
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      That’s actually filtering not sorting.

      That being said, it’s more valuable (to me) to be able to find all my things for a topic quickly rather than type.

      Foo_dialog

      Foo_action

      Foo_map

      Bar_dialog

      Bar_action

      Bar_map

      Is superior IMHO.