Leaving yourself notes/comments when you've 'passed the point of no return'

Sometimes when I’m working on a script, automation, template entity, or package when it’s late and I’m getting too tired, or too drunk, I’ll disallow myself to touch the actual config anymore. But since I can’t stop thinking about it I’ll leave myself a note inside a comment in the appropriate spots and pray that I can make heads or tails of it when I read it again.

2 days ago I wrote myself the following and have only a vague memory of having done so…

      # if player_id|has_value then great (standard call script action),
      #   else if node.user_name is defined
      #           and context.id
      #           and domain.player_id_~node.user_name|mapped|has_value then great (frontend call, user specific),
      #   else fuck-off

I opened up the file today… It made me laugh and I understood exactly what I had in mind at the time… win win.

Does anyone else do this in a similarly absurd manner?

1 Like

I did this in am HA Python in a Pi MQTT-ing data to Home Assistant thing. I was stuck, did the absolutely worst work around ever. 3 years later found it and fixed it because the comment was there to remind me.

I can relate to both, the reasons to stop working on code, and the time it takes sometimes to re-visit the code and see the comments (which you will be glad to have left there years ago). :slight_smile:

During Y2K work, comments were often a lifesaver, where the ‘why’ was spelt out, making it far easier to update code and keep an eye out for gotchas or hidden interdependencies.
Some of these were there since the punch card era.
Left a lot of comments for the Y2K38 crowd. Pay it forward.