#5383: isinstance(PrincipalIdealDomain) should be replaced with a method
.is_principal_ideal_domain()
----------------------------+-----------------------------------------------
Reporter: ncalexan | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-3.4
Component: linear algebra | Keywords: principal ideal domain span free
module isinstance
----------------------------+-----------------------------------------------
This is the cause of things like:
{{{
sage: R.<x, y> = QQ[]
sage: M = R^2
sage: span(R, vector([1, 0]))
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/ncalexan/.sage/temp/dhcp_v009_038.mobile.uci.edu/301/_Users_ncalexan_Documents_School_rumely_polynomial_ring_as_module2_sage_142.py
in <module>()
/Users/ncalexan/sage-3.3.rc0/local/lib/python2.5/site-
packages/sage/modules/free_module.pyc in span(gens, base_ring, check,
already_echelonized)
408
409 if not isinstance(R,
principal_ideal_domain.PrincipalIdealDomain):
--> 410 raise TypeError, "The base_ring (= %s) must be a principal
ideal domain."%R
411 if len(gens) == 0:
412 return FreeModule(R, 0)
TypeError: The base_ring (= Multivariate Polynomial Ring in x, y over
Rational Field) must be a principal ideal domain.
}}}
Surprisingly few places where this bites us:
{{{
sage: search_src('PrincipalIdealDomain')
modules/free_module.py: elif isinstance(base_ring,
principal_ideal_domain.PrincipalIdealDomain):
modules/free_module.py: if not isinstance(R,
principal_ideal_domain.PrincipalIdealDomain):
modules/free_module.py: if not isinstance(base_ring,
principal_ideal_domain.PrincipalIdealDomain):
modules/free_quadratic_module.py: elif isinstance(base_ring,
principal_ideal_domain.PrincipalIdealDomain):
rings/all.py:from principal_ideal_domain import PrincipalIdealDomain,
is_PrincipalIdealDomain
rings/all.py:from principal_ideal_domain_element import
PrincipalIdealDomainElement, is_PrincipalIdealDomainElement
rings/ideal.py: if isinstance(R,
sage.rings.principal_ideal_domain.PrincipalIdealDomain):
<snip>
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5383>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---