On Fri, Aug 10, 2018 at 9:48 PM Jeroen Demeyer <[email protected]> wrote:
>
> On 2018-08-09 14:54, Erik Bray wrote:
> > In principle, if classes had this, one might also want it for
> > functions, but that's a little bit more problematic.
>
> I think that's already a bit problematic: whether something is a class
> or a function should really be an implementation detail. For example,
> there are quite a few important constructor functions in Sage such as
> Matrix() or PolynomialRing().
>
> But adding a help "method" for functions shouldn't be too hard actually.
> Non-built-in functions have a __dict__ so you could add a help attribute
> (it wouldn't be a method strictly speaking). And I guess that things
> were you care about help() are high-level enough that the performance
> regression of making them non-built-in is acceptable.
>
> You could use the decorator syntax to have a common syntax both for
> functions and methods.
>
> Just an idea...

I agree--that could work in most cases.  In either case I don't think
questions of implementation details are an argument for or against
having functionality like this in the first place.

Personally, I'm not 100% convinced having a .help() method is a good
idea either, but I'm also not convinced by the arguments I've seen
against so far, and I think I can see some potential advantages.

If nothing else I think we're all in agreement that the global help()
needs to be fixed.  Nobody's commented yet on the odd differences in
level of output from `help(<obj>)` and `<obj>?`.  I had never noticed
before--and was surprised to find--that `<obj>?` on a class does *not*
appear to list the class's methods, which seems like a massive
omission to me.  Is that intentional?  What's that about?

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to