Dear Aidan, Do you have a trac account? I didn't find you there.
Your interesting question has triggered a very detailed answer by Nils, and other have suggested to turn it into proper documentation. As someone who is in the process of learning the internals of Sage too, I also think that explaining further about name usage in Python / Sage is a very useful contribution. I look forward to following up this thread in trac! Cheers, Marcelo.- El domingo, 19 de marzo de 2017, 8:54:34 (UTC+1), Aidan escribió: > > > I wrote some code > <https://gist.github.com/aijony/8675b9b348a7c510d634f768d5ad7e8e> I would > like to contribute, but I don't know the most appropriate place to put it. > > It works like this right now > > > sage: g(x,y) = x + sin(y) > (x, y) |--> x + sin(y) > sage: g = name('g', g) > sage: g > g(x, y) == x + sin(y) > > > I would say it is naming an expression or unnamed function to a function, > but if it is actually doing something else, please let me know. > > I am trying to discern where to put it in the code base (assuming people > want it) > > Somewhere like here > <http://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression_conversions.html#sage.symbolic.expression_conversions.Converter.composition> > > made sense to me, but that might be my horrible understanding of > programming. > > This would be as function, so it would return the value like in the > example above. > > But I also was thinking of putting it in as a method in > sage.symbolic.expression > <http://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression.html#symbolic-expressions> > > as a method that mutates an expression object. > I don't know if this is allowed. > > I don't think I can call this name() because symbolic.function already has > a name() > <http://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/function.html?highlight=function#sage.symbolic.function.Function.name> > > What would be some good names, I want to be short as the whole idea of > this function is to be a short cut from > sage: g = f; f = function('f')(x) == g > to something more like > sage: f.set_name('f') > > I've thought of: > > - set_name() > - set_func() > - assign() > - name() > - give_name() > > I'd love constructive feedback. > > - Does this have a place in Sage? > - Where? > - What do you think of the code? > - What would be a good name? > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.