I use this very helpful macro when developing in C++:
#define DD(a) std::cout << #a \" = [ \" << a << \" ]\" << std::endl;std::cout.f
The Rod solution is perfectly usable. It could be even extended to handle many vars. But you can get close to that with much less magic:
def dd(**kwargs): print ", ".join(str(k) + "=" + str(v) for k, v in kwargs.iteritems()) a = 1 dd(a=a,b=3)
output:
a=1, b=3