On Aug 23, 2009, at 12:42 PM, William Stein wrote: > On Sun, Aug 23, 2009 at 12:27 PM, Sebastian Pancratz > <s...@pancratz.org> wrote: > > I think as a first step I'll only implement the additional argument > for the two methods "is_field" and "is_integral_domain".
+1 to this idea. > For the other suggestion, namely to allow the user to assert that a > ring is in fact a field, would the following be the "right" way to > implement this? 1. Add a new attribute to the ring class, say > IS_FIELD, initialised to None, 2. Implement "assert_field(check)" to > set IS_FIELD = check, 3. Change "is_field" such that (ignoring the > issue about raising an exception or returning False) if IS_FIELD is > None it should behave as now and otherwise it should return the value > of IS_FIELD. > > Don't make it upper case. Make the attribute _is_field. Otherwise > the above sounds great to me. I'm not sure about this--it means everyone implementing an is_field method will have to know about this "trick" and the number of properties to know about grows as the number of is_* methods. What I'd rather see is something like sage: R = Zmod(6) sage: K = categories.Fields(R, check=False) # any ring R sage: K Ring of integers modulo 6 as a field. sage: K.is_field() True where all other methods are inherited via dynamically. - Robert --~--~---------~--~----~------------~-------~--~----~ 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 URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---