1 | initial version |

The original question tried to replicate the syntax in which sage prints derivatives. This comes up more often. Isn't it time to include (perhaps not in the global namespace, but at least somewhere from which it is easily important) an object that allows users to do so? It's valid python syntax so it's fairly easy to do. It does require boilerplate that's a bit beyond a one-liner, though:

```
from sage.symbolic.operators import FDerivativeOperator
class Dclass(object):
def __init__(self,L=None):
if L is None:
self.L=[]
else:
self.L=L
def __getitem__(self,index):
if isinstance(index,tuple):
index=list(index)
elif not(isinstance(index,list)):
index=[index]
return Dclass(self.L+index)
def __call__(self,arg):
return FDerivativeOperator(arg,self.L)
def __repr__(self):
return "D"+str(self.L)
D=Dclass()
```

With this definition you can just write:

```
sage: function('f'); var('x','y','z')
sage: D[0,1,2](f)(x,y,z)
diff(f(x, y, z), x, y, z)
```

2 | No.2 Revision |

The original question tried to replicate the syntax in which sage prints derivatives. This comes up more often. Isn't it time to include (perhaps not in the global namespace, but at least somewhere from which it is easily ~~important) ~~imported) an object that allows users to do so? It's valid python syntax so it's fairly easy to do. It does require boilerplate that's a bit beyond a one-liner, though:

```
from sage.symbolic.operators import FDerivativeOperator
class Dclass(object):
def __init__(self,L=None):
if L is None:
self.L=[]
else:
self.L=L
def __getitem__(self,index):
if isinstance(index,tuple):
index=list(index)
elif not(isinstance(index,list)):
index=[index]
return Dclass(self.L+index)
def __call__(self,arg):
return FDerivativeOperator(arg,self.L)
def __repr__(self):
return "D"+str(self.L)
D=Dclass()
```

With this definition you can just write:

```
sage: function('f'); var('x','y','z')
sage: D[0,1,2](f)(x,y,z)
diff(f(x, y, z), x, y, z)
```

3 | No.3 Revision |

The original question tried to replicate the syntax in which sage prints derivatives. This comes up more often. Isn't it time to include (perhaps not in the global namespace, but at least somewhere from which it is easily imported) an object that allows users to do so? It's valid python syntax so it's fairly easy to do. It does require boilerplate that's a bit beyond a one-liner, though:

```
from sage.symbolic.operators import FDerivativeOperator
class Dclass(object):
def __init__(self,L=None):
if L is None:
self.L=[]
else:
self.L=L
def __getitem__(self,index):
if isinstance(index,tuple):
index=list(index)
elif not(isinstance(index,list)):
index=[index]
return Dclass(self.L+index)
def __call__(self,arg):
return FDerivativeOperator(arg,self.L)
def __repr__(self):
return "D"+str(self.L)
D=Dclass()
```

With this definition you can just write:

```
sage: function('f'); var('x','y','z')
sage: D[0,1,2](f)(x,y,z)
diff(f(x, y, z), x, y, z)
```

This is now https://trac.sagemath.org/ticket/25054

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.