How can you identify if a Shimano rear derailleur is medium or long cage?
The picture is a RD-M780-SGS long cage.

Shimano have three codes for rear derailleur length:


Short - SS
Medium - GS
Long - SGS


I'm not aware of where this is printed on the RD though so not so helpful. 

However Shimano only have one non-clutched XT Dyna-Sys (10 speed) RD the RD-M780-SGS (long cage 43t capacity). The clutched (shadow+) RDs come in GS (medium 35t cap) and SGS (long 43t cap).

Saint derailleurs come in SS (short 23t cap with cassette extender) and GS (medium 37t cap with cassette extender) for more gravity focused 1x set ups.