Justin Walker wrote: > > On Sep 9, 2008, at 7:25 PM, Jason Grout wrote: > >> Jason Merrill wrote: >>> On Sep 9, 6:35 pm, Justin Walker <[EMAIL PROTECTED]> wrote: >>>> Hi, all, >>>> >>> There may be a more pythonic way to do this--I'm just trying to >>> translate something I saw in Ruby. I think I've seen at least one >>> person define an @cache decorator somewhere on the web. >> I believe we have such a decorator already in Sage, courtesy of >> mhansen, >> and of all people, the original poster :). > > OK, that's just mean. I have to go think about this some more. It's > more work than I was planning on tackling at this point... > > But thanks for reminding me about the dangers of partaking of the > Internet Experience. > > Justin > > :-}
Sorry...I was really tired last night when I wrote this, so it may have come out meaner than I intended. The credits to the file say that the original implementation was inspired by conversations with Justin, which may not be the same as Justin actually writing the code. Again, I think JM's approach has some advantages over the current decorator in Sage, though, as the current decorator doesn't replace the function if it is a constant function; instead, it looks up the arguments (None, None) every single time. Maybe it would be nice to have a special case in the cached decorator or another @cachedconstantfunc or something. Thanks, Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---