Fixing the ubiquitous accessing of .value would be far more work that it's worth. The main functionality that I would like is a get_si() with bounds checking. Given that, I think having a set_si as well is reasonable. David
On Mon, Mar 3, 2008 at 9:36 AM, Joel B. Mohler <[EMAIL PROTECTED]> wrote: > > On Monday 03 March 2008 08:42:53 am David Roe wrote: > > I think they should still exist, but should be cdef'd. This means I can > > interface between C longs and sage Integers without having to reach in > and > > grab n.value, but one can't use them to make Integers mutable in Python. > A > > function get_si() would also be useful if it did bounds checking so that > I > > don't have to worry about the mpz_t not fitting in a long. > > David > > That would be fine with me. Although, we already violate the information > hiding aspect quite a bit -- that is, we already access n.value quite > freely > from matrix and vector code (for instance). So, I'm not sure that that is > worth talking about -- although maybe your point was that we should > respect > the private-ness of value and fix all that? > > In any case, the real point is that this should be removed from tab > completion > list and cdef'ing them would do that. > > -- > Joel > > > > > On Mon, Mar 3, 2008 at 8:02 AM, Joel B. Mohler <[EMAIL PROTECTED]> > > > > wrote: > > > Hi, > > > > > > These methods set_si & set_str violate immutability: > > > sage: n=300 > > > sage: n.set_si(12) > > > sage: n > > > 12 > > > > > > Shouldn't they be called _set_unsafe_xx? Better yet, shouldn't they > be > > > deleted altogether since I can't find anywhere they are used in code > > > aside from doc-tests? Or, was that the point -- to doc-test > something? > > > > > > The Rational object also has these methods. > > > > > > -- > > > Joel > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---