Bug introduced in 10.1 and fixed in 11.1
Thank you for taking the time to send in this report. It does appear that pattern-variable renaming misses symbols within Except when using With. I will forward an incident report to our developers regarding this issue, and include the discussion in the stack exchange article.
With[{u = {f}},
HoldPattern[G[f_, Except[f_]]] :> u
]
gives
HoldPattern[G[f$_, Except[f_]]] :> {f}
I would expect
HoldPattern[G[f$_, Except[f$_]]] :> {f}
Bug?
f
touched at all. Curiously, if you tryWith[{u = {f}}, HoldPattern[G[f_, Except[f_]]]]
you getHoldPattern[G[f_, Except[f_]]]
. $\endgroup$:>
is a scoping construct and could potentially havef
on the RHS as well (in addition to the LHS as a pattern name). In that case the uniqueness (localization) off
must be guaranteed. Mathematica is a bit overeager in doing this. $\endgroup$