Haskell has two very nice libraries, bytestring and vector which use rewrite rules to have performance comparable to C code.
Operations on dictionaries with default values implemented using inheritance from dictionary. This means that instead of just having conditional expression on the right side I have a call to virtual function and there is an expression on the right side of assignment or return statement.
Most of OO virtual machines can JIT things like these into efficient machine code, by specializing. The same is also quite possible with bytecode like in CPython - by optimization in the compiler or by introduction of rewrite rules like above for library implementors to specify rules that apply to any (transformed) user code.
I must admit I don't quite understand what rewrite rules actually are; are they akin to macros?
Rewrite rules fire when compiler encounters a chance for them to fire, at any point of (optimizing) program transformation.
Due to this fact, rewrite rules are not local - compiler can transform the inner structure of a program changing the locality of program statements.
bs = map g xs
... many other lines of program text not reassigning bs
as = map f bs
still can be transformed into "as = map (f . g) xs" by rule "map f (map g xs) => map (f . g) xs" due to substitution.
Most of the time, people does not leave Python when it is not satisfactory. They stick with it because they have no clue, most of the time.
For example, it is not quite natural for Python folks to even think about creating rewrite rules (as in Haskell) for programs to stay at higher level of expression. E.g., if you use dictionary with default value, why not lift all operations up (inline, so to say) and avoid calling these that are overloaded? It bit me many times, yet other users of Python just gave me blank stare when I tried to explain these things.