Simplify class verification in LinExpr.fromstring()