Why does Plot[D[x,x],{x,1,10}] throw error? [duplicate]


I am experiencing unexpected behavior from Plot and D, and I would like to understand why. If I try this:

Plot[D[x,x],{x,1,10}]

I get a General::ivar error, but if I do this:

f = D[x,x]

Plot[f,{x,1,10}]

it works just fine. I come from a Python/Julia background, so I find this behavior baffling. What is going on here?