The canonical variables I think is better because it also fixes other issues other than this. But do you think general_function may be of some utility for sympy? It returns a representation of function so that the user is clear what are function variables and what are functions.