Ticket #9054: trac_9054_isFunctionField.patch

File trac_9054_isFunctionField.patch, 1.4 KB (added by saraedum, 6 years ago)

use category in is_FunctionField()

  • sage/rings/function_field/function_field.py

    exporting patch:
    # HG changeset patch
    # User Julian Rueth <julian.rueth@gmail.com>
    Trac 9054: check category in is_FunctionField()
    
    diff --git a/sage/rings/function_field/function_field.py b/sage/rings/function_field/function_field.py
    index cdca9d2..4b64405 100644
    a b def is_FunctionField(x): 
    7676        sage: is_FunctionField(FunctionField(QQ,'t'))
    7777        True
    7878    """
    79     return isinstance(x, FunctionField)
    80 
     79    if isinstance(x, FunctionField): return True
     80    from sage.categories.function_fields import FunctionFields
     81    return x in FunctionFields()
    8182
    8283class FunctionField(Field):
    8384    """
  • sage/rings/function_field/function_field_element.pyx

    diff --git a/sage/rings/function_field/function_field_element.pyx b/sage/rings/function_field/function_field_element.pyx
    index d45f523..9d0babd 100644
    a b def is_FunctionFieldElement(x): 
    1414        sage: sage.rings.function_field.function_field_element.is_FunctionFieldElement(0)
    1515        False
    1616    """
    17     return isinstance(x, FunctionFieldElement)
     17    if isinstance(x, FunctionFieldElement): return True
     18    from function_field import is_FunctionField
     19    return is_FunctionField(x.parent())
    1820
    1921def make_FunctionFieldElement(parent, element_class, representing_element):
    2022    """