On 05/18/2010 11:14 AM, John Cremona wrote:
In our example, how does DifferentialForms() know that there are three
variables?

Also, note that the syntax F.<x,y,z>  =  ... would normally be a
shorthand for something like F = ....; x,y,z = F.gens().

Good point. Joris, the <x,y,z> syntax is just syntactic sugar that is preparsed into:

sage: preparse('F.<x,y,z>=DifferentialForms()')
"F = DifferentialForms(names=('x', 'y', 'z',)); (x, y, z,) = F._first_ngens(3)"

So you can see from the "(x,y,z,)=..." statement that you are in reality defining the variables "x", "y", and "z", and there is nothing a class can do about that without changing the preparser.

In fact, if I wanted to call what you call "dx" by the name "x", I suppose that is my business, regardless of how many conventions it messes up :).

In that sense, would it be so hard to expect the user to do something like:

F.<dx,dy,dz>=DifferentialForms()

which preparses into

sage: preparse('F.<dx,dy,dz>=DifferentialForms()')
"F = DifferentialForms(names=('dx', 'dy', 'dz',)); (dx, dy, dz,) = F._first_ngens(3)"

Thanks,

Jason


--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to