title: Mimic ++ operator for bookkeeping variable
body: <p>For my application GUI (tkinter), I need a 'bookkeeping' variable that holds the current row number for a UI widget. I prefer not to hard code the row number because inserting a widget would involve renumbering all row numbers following it. In this situation, an increment operator (<code>x++</code>, similar to C++) would come in very handy, because incrementing the variable when necessary would require only two additional characters. However, Python <a href="https://stackoverflow.com/a/1485854/12646289">does not support increment operators</a>.</p>
  
  <p>To avoid increment statement between elements that should go on different rows, I came up with the following solution but I am wondering what an alternative might be:</p>
  
  <pre><code>rownums = list(range(100))
  rowstay = lambda: rownums[0]        # Return current row number and stay on row.
  rowmove = lambda: rownums.pop(0)    # Return current row number and move on to next.
  
  print(f'Two items: {rowstay()}, {rowmove()}')
  print(f'One item: {rowmove()}')
  print(f'Two items: {rowstay()}, {rowmove()}')
  </code></pre>
  
  <p>For example (tkinter):</p>
  
  <pre><code># Create some buttons.
  mybutton1 = tkinter.button(master, 'Button on row 0')
  mybutton2 = tkinter.button(master, 'Button on row 0')
  mybutton3 = tkinter.button(master, 'Button on row 1')
  
  
  # Place buttons (use mimicked increment 'operator').
  mybutton1.grid(row=rowstay(), column=0)
  mybutton2.grid(row=rowmove(), column=1)
  mybutton3.grid(row=rowmove(), column=0)
  
  </code></pre>
  
  <p>What alternative code would provide the same functionality?</p>