Pensieve header: Better learning from experience.

f[i_] := Expand[(((i+1))^2)]

?f

g[i_] := Evaluate[Expand[(((i+1))^2)]]

?g

i=2;
h[i_] := Evaluate[Expand[(((i+1))^2)]]

?h

i=2;
Module[{i},k[i_] := Evaluate[Expand[(((i+1))^2)]]]

?k

i=2;
Block[{i},a[i_] := Evaluate[Expand[(((i+1))^2)]]]

?a

i=2;
Block[{i},b[i_] = Expand[(((i+1))^2)]]

?b

i=2; c[i_] = Block[{i},Expand[(((i+1))^2)]]

?c