Hi Mike,
On 1 Aug., 03:10, Mike Hansen <[email protected]> wrote:
> On Tue, Jul 27, 2010 at 12:30 PM, Simon King <[email protected]> wrote:
> > So, the fact that RingElement uses the category framework means that
> > both the code *and* the documentation are hidden behind layers of
> > abstraction, to the extent that they can actually not be accessed *at
> > all*, unless one untars the spkg? That's pretty nasty and, I might
> > add, anti-pedagogical.
>
> This is not that case -- please stop using the "category framework" as
> a scapegoat.
Note that my post was a reaction on Robert's statement that it *is*
related with categories (or at least, he pointed to a thread on
categories) - that's where the question mark in my post comes from.
At that point,I thought that method-wrapper is a specialty of
categories, but ...
> Suppose you have the following code.
>
> cdef class Foo:
> def __pow__(self, n, z):
> return 4
> f = Foo()
>
> Then, f.__pow__?? will fail since f.__pow__.__doc__ is a special
> read-only attribute and does not contain the file information needed
> by the introspection system to find the source code.
... your example shows that I misunderstood. I hope you all accept my
apologies.
So, let me resume my original question: Is there a way to at least get
a *documentation* of __pow__?
Modifying your example:
cdef class Foo:
def __pow__(self, n, z):
"""
This has a documentation
"""
return 4
f = Foo()
This attempt to provide a doc string fails, as one still gets
sage: f.__pow__.__doc__
'x.__pow__(y[, z]) <==> pow(x, y[, z])'
You say that "f.__pow__.__doc__ is a special read-only attribute",
apparently even at the time when the code is generated. But for what
reason? Is there really no way around?
Where can I learn more about method-wrapper?
Cheers,
Simon
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org