Actually I think deleting the is_functions deserves it's own thread,
so ignore my last message and see:
http://groups.google.com/group/sage-devel/browse_thread/thread/e8c2470e270f616b

-Jim

On Tue, Mar 27, 2012 at 10:06 AM, Starx <jst...@gmail.com> wrote:
> There are 260 functions defined in Sage of the form def is_Name(x)
> where Name starts with a capitol letter (my script 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.  Deleting them and replacing all there calls with calls to
> isinstance and all there imports with imports of Name is not something
> I'd like to do by hand, so I'm working on a script that will do it.
>
> 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, any arguments to the contrary?
>
> -Jim
>
> On Tue, Mar 27, 2012 at 7:55 AM, David Roe <r...@math.harvard.edu> wrote:
>>
>>> More importantly, what happens if coercion etc. fails?  Will Sage then
>>> potentially make false mathematical statements, or raise an
>>> exception / return "unknown" or "undecidable" etc.
>>
>>
>> No.  It catches the ValueErrors and TypeErrors, and returns False (so
>> ZZ['x'].gen() is not in QQ).
>> David
>>
>> --
>> 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
>
>
>
> --
> Die Dunkelheit... leitet die Musik.
> Die Musik... leitet die Seele.



-- 
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

Reply via email to