Depending on the answer for @abarnert question you may think about using SymPy:
>>> from sympy import Symbol
>>> np.diag([Symbol(x) for x in ['a','b','c','d','e']])
array([[a, 0, 0, 0, 0],
[0, b, 0, 0, 0],
[0, 0, c, 0, 0],
[0, 0, 0, d, 0],
[0, 0, 0, 0, e]], dtype=object)