Op-amp output and input shorted
What happens to an op amp (in my case, TL072) if the output is
  directly shorted to the input?


Your circuit (without the short) appears to be a non-inverting amplifier and potentially might have a gain of 1 + R4/R3 but, as you don't show where R3 connects this can only be a best estimate on my part. So, shorting output to input will render the circuit with a gain of 1. This assumes that what you are feeding to pin 3 (the non-inverting input) is a voltage source of much lower output impedance than what the op-amp can muster.

In other words, a fairly useless circuit.


  This got me wondering how the amp would behave with a capacitor
  between input and output rather than a direct short. Can anyone
  advise?


The only circuit I can think of (off the top of my head) that uses a capacitor from output to non-inverting input is one like this: -



Picture from this stack exchange question (a question and answer about schmitt trigger circuits). So does the link to the previous question provide enough insight into the circuit?


  And does the behavior change whether it is inverting or non-inverting?


There is a significant difference; when the output feeds back to the inverting pin, the circuit behaves like a unity gain voltage buffer capable of buffering a high impedance signal.



Picture taken from here.