You can do this with the xlogy function in scipy:
from scipy.special import xlogyfrom numpy import log>>> xlogy(10, 10)23.0258509299>>> 10 * log(10)23.0258509299>>> xlogy(0, 0)0.0