Hi Nils, hi Florent, On 2013-02-02, Nils Bruin <nbr...@sfu.ca> wrote: > into decorator syntax, you basically want to partially apply > cached_method, so that you can write > > @cached_method(name="truc_cache") > def truc(...): > ... > trac = truc
Would be nice to have. But I think it would be both easier and cleaner to separate the creation of the class from the creation of method aliases: sage: class Foo(object): ....: @cached_method ....: def truc(self, x): ....: print "calling truc" ....: return x+1 ....: sage: Foo.trac = Foo.truc sage: f = Foo() sage: f.trac is f.truc True sage: f.truc(1) calling truc 2 sage: f.truc(1) 2 sage: f.trac(1) 2 Isn't that exactly as Florent wants it? Cheers, Simon -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en. For more options, visit https://groups.google.com/groups/opt_out.