#15759: cached_method: __name__ and __module__ attributes; callable as
functions /
class bound methods
-------------------------------------------------+-------------------------
Reporter: nthiery | Owner:
Type: enhancement | Status: closed
Priority: major | Milestone: sage-6.2
Component: misc | Resolution: fixed
Keywords: | Merged in:
Authors: Nicolas M. ThiƩry | Reviewers: Simon
Report Upstream: N/A | King
Branch: | Work issues:
6b18661787e2d518fca76d0a22c4eb5a6ab49a08 | Commit:
Dependencies: | Stopgaps:
-------------------------------------------------+-------------------------
Changes (by robertwb):
* commit: 6b18661787e2d518fca76d0a22c4eb5a6ab49a08 =>
Old description:
> This ticket adds the following features to cached methods to make them
> behave more like usual methods:
>
> - __name__ and __module__ attributes
> - calling them as functions / methods bound on a class:
> {{{
> class Foo:
> @cached_method
> def f(self):
> ...
>
> sage: instance = Foo()
> sage: Foo.f(instance) is instance.f()
> sage: Foo.__dict__['f'](instance) is instance(f)
> }}}
>
> This makes them compatible with, e.g., deprecated_function_alias:
> {{{
> class Foo:
> @cached_method
> def f(self):
> ...
> bar = deprecated_function_alias(12963, f)
> }}}
New description:
This ticket adds the following features to cached methods to make them
behave more like usual methods:
- __name__ and __module__ attributes
- calling them as functions / methods bound on a class:
{{{
class Foo:
@cached_method
def f(self):
...
sage: instance = Foo()
sage: Foo.f(instance) is instance.f()
sage: Foo.__dict__['f'](instance) is instance(f)
}}}
This makes them compatible with, e.g., deprecated_function_alias:
{{{
class Foo:
@cached_method
def f(self):
...
bar = deprecated_function_alias(12963, f)
}}}
--
Comment:
Remove tabs from description.
--
Ticket URL: <http://trac.sagemath.org/ticket/15759#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.