sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 480 forks source link

Fix the documentation of abstract methods. #8571

Open hivert opened 14 years ago

hivert commented 14 years ago

Currently, the documentation of abstract methods has the following annoying problem, it doesn't appear when asked with "?" from a parent.

sage: P = Parent(category=CoxeterGroups())
sage: P.index_set?
Object `P.index_set` not found.
sage:                                

You have to write:

sage: CG = CoxeterGroups()
sage: CG.ParentMethods.index_set?
Type:           AbstractMethod
Base Class:     <class 'sage.misc.abstract_method.AbstractMethod'>
String Form:    <abstract method index_set at 0x219a320>
Namespace:      Interactive
File:           /usr/local/sage/sage/local/lib/python2.6/site-packages/sage/misc/abstract_method.py
Definition:     CG.ParentMethods.index_set(self)
Docstring:
       Returns the index set of (the simple reflections of) ``self``, as a
       list (or iterable).

Class Docstring:
       Constructor for abstract methods
[...]

This should be fixed.

CC: @nthiery

Component: documentation

Keywords: abstract methods

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

hivert commented 14 years ago

Description changed:

--- 
+++ 
@@ -1,4 +1,29 @@
-Currently, the documentation of abstract methods has two annoying problems:
-- it doesn't appear when asked with "?" 
-- nothing says that they are abstract method in the doc.
+Currently, the documentation of abstract methods has the following annoying problem, it doesn't appear when asked with "?" from a parent.
+
+```
+sage: P = Parent(category=CoxeterGroups())
+sage: P.index_set?
+Object `P.index_set` not found.
+sage:                                
+``` 
+You have to write:
+
+```
+sage: CG = CoxeterGroups()
+sage: CG.ParentMethods.index_set?
+Type:           AbstractMethod
+Base Class:     <class 'sage.misc.abstract_method.AbstractMethod'>
+String Form:    <abstract method index_set at 0x219a320>
+Namespace:      Interactive
+File:           /usr/local/sage/sage/local/lib/python2.6/site-packages/sage/misc/abstract_method.py
+Definition:     CG.ParentMethods.index_set(self)
+Docstring:
+       Returns the index set of (the simple reflections of) ``self``, as a
+       list (or iterable).
+
+Class Docstring:
+       Constructor for abstract methods
+[...]
+```
 This should be fixed.
+
nthiery commented 14 years ago
comment:2

We should also think about if/how to merge with Python's new abstractmethods:

http://docs.python.org/library/abc.html