def __contains__(self, x): """ EXAMPLES:: sage: GF(4, "a") in FiniteFields() True sage: QQ in FiniteFields() False sage: IntegerModRing(4) in FiniteFields() False """ return is_Field(x) and x.is_finite()
def __contains__(self, x): """ EXAMPLES:: sage: GF(4, "a") in Fields() True sage: QQ in Fields() True sage: ZZ in Fields() False sage: IntegerModRing(4) in Fields() False sage: InfinityRing in Fields() False This implementation will not be needed anymore once every field in Sage will be properly declared in the category :class:`Fields`(). Caveat: this should eventually be fixed:: sage: gap.Rationals in Fields() False typically by implementing the method :meth:`category` appropriately for Gap objects:: sage: GR = gap.Rationals sage: GR.category = lambda : Fields() sage: GR in Fields() True """ try: return self._contains_helper(x) or is_Field(x) except: return False