How much are these functions used in the Sage library? I would be supportive of removing them all if possible.... David
On Tue, Mar 27, 2012 at 18:29, Starx <jst...@gmail.com> wrote: > This discussion stems from: > > http://groups.google.com/group/sage-devel/browse_thread/thread/979bdce4e002cd05/e8061b2ff21a4cdf?lnk=gst&q=is_AlgebraElement#e8061b2ff21a4cdf > I decided it deserves it's own thread. > > The is_functions (is_Integer, is_AlgebraElement, ect) are depreciated > and have been for 4 years now. I think it's time some of them got > deleted, but I'm not sure all of them should go. > > There are 260 functions defined in Sage of the form def is_Name(x) > where Name starts with a capitol letter (I didn't count the cdef > functions so there might actually be more). Of those 110 of them > simply return isinstance(x, Name) and I think those 110 can definitely > be deleted in favor of users using isinstance(x, Name). Deleting > them, replacing all their calls with calls to isinstance, and all > their imports with imports of Name is not something I'd like to do by > hand, so I'm working on a little script. > > As for the other 150, some of them do the following: > > def is_Name(x) > return isinstance(x, Name_something) > > I didn't check but I suspect that there is a factory called Name which > is why the _whatever is there. Another example of this issue is that > is_Cone(x) returns isinstance(x, ConvexRationalPolyhedralCone) and the > function Cone constructs ConvexRationalPolyhedraCones. I'm undecided > on whether we should remove these is_functions as well. Is the user > expected to know that the factory is just a factory? and look through > the source code to figure out what the class name is? > > Finally there are some is_functions that return something slightly > more complicated then a single isinstance, for example > > def is_PrimeFiniteField(x): > some imports > return isinstance(x, FiniteField_prime_modn) or \ > (isinstance(x, FiniteField_generic) and x.degree() == 1) > > I would probably just leave these alone but I think others who've been > at this longer might have a better idea of what the best course of > action is. It seems to me that after 4 years they should either go or > they shouldn't be depreciated. > > -Jim > > -- > Die Dunkelheit... leitet die Musik. > Die Musik... leitet die Seele. > > -- > 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 > -- 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