Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make NamedBinopMethod remember the name and module #17673

Closed
videlec opened this issue Jan 25, 2015 · 8 comments
Closed

Make NamedBinopMethod remember the name and module #17673

videlec opened this issue Jan 25, 2015 · 8 comments

Comments

@videlec
Copy link
Contributor

videlec commented Jan 25, 2015

Currently

sage: from sage.structure.element import coerce_binop
sage: @coerce_binop
....: def f(a,b): return a+b
sage: f.__module__
Traceback (most recent call last):
...
AttributeError: ...
sage: f.__name__
Traceback (most recent call last):
...
AttributeError: ...

and with the branch

sage: from sage.structure.element import coerce_binop
sage: @coerce_binop
....: def f(a,b): return a+b
sage: f.__module__
'__main__'
sage: f.__name__
'f'

That way methods with this decorator will looks like method. In particular it will not break introspection (e.g. access to the documentation with ? and to the source code with ??).

Component: coercion

Issue created by migration from https://trac.sagemath.org/ticket/17673

@videlec videlec added this to the sage-6.5 milestone Jan 25, 2015
@videlec
Copy link
Contributor Author

videlec commented Jan 25, 2015

Branch: public/17673

@videlec
Copy link
Contributor Author

videlec commented Jan 25, 2015

New commits:

7d2009ctrac #17673: __module__/__name__ for coerce_binop

@videlec
Copy link
Contributor Author

videlec commented Jan 25, 2015

Commit: 7d2009c

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor Author

videlec commented Jan 28, 2015

comment:2

It seems that I had a bug on my computer since the introspection is perfectly fine without this... obscure!

@videlec
Copy link
Contributor Author

videlec commented Jan 28, 2015

Changed branch from public/17673 to none

@videlec
Copy link
Contributor Author

videlec commented Jan 28, 2015

Changed commit from 7d2009c to none

@videlec
Copy link
Contributor Author

videlec commented Jan 28, 2015

Changed author from Vincent Delecroix to none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants