On Tue, Mar 27, 2012 at 10:29:12AM -0700, Starx wrote:
> ...

+1 on reducing the number of is_... functions.

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

Precisely for this purpose, we (Florent, me, ...) are in favor, in
such situation, of merging the factory "Name" and the class
Name_something, so that one can do both:

        sage: Name(...)
        sage: isinstance(..., Name)

with a single gadget imported by default in sage.all.

See the discussion in ClasscallMetaclass for one way to implement
that, and IntegerRange for an example.

Also, the idiom ``is_Field(P)`` would be best replaced by ``P in Fields()``.

On a related note: with Simon King, we are in favor of keeping both
the two idioms ``P in Fields() and ``P.is_field()``, With slightly
different semantic:

 - P in Fields(): is P already known to be a field? I.e. is the
   category of P a subcategory of Fields()?
 - P.is_field(): decide whether P is a field, possibly running a
   costly computation if needed. If the answer is positive, P is
   typically upgraded to the Fields() category.

Cheers,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

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