4.17 How to obtain a list of all arguments of the D function in an expressions?

Given an expression used for initial/boundary conditions, such as D(y)(3)+(D@@2)(y)(0)=1, the question is, how to obtain all arguments of each D in the above to verify that it does not include the independent variable \(x\) in this example?

One way is to use indets to select all such functions from the expression, then use op as above to find the arguments.

expr:=D(y)(3)+(D@@2)(y)(0)+1/(D@@3)(y)(x)=0; 
(lhs-rhs)(expr); 
L:=indets(%,':-De'); 
map(X->op(1,X),L); 
if has(%,x) then 
   error "Can not have x in argument for D used for initial/boundary conditions"; 
fi;
 

Which gives

Error, Can not have x in argument for D used for initial/boundary conditions because we had (D@@3)(y)(x) there.