if (diff := x - x_base) and (g := gcd(diff, n)) > 1:
         return g


I don't see the advantage in that succinctness:

g = special_gcd(x - x_base, n)
if g:
    return g

The code bases I work on constantly move towards having the next guy grok what's going on just by reading the code.

It could also be:

if special_gcd(x - x_base, n) as g:
    return g

Cheers!

Juancarlo Añez