File: special_method_docstrings.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (47 lines) | stat: -rw-r--r-- 1,088 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cdef class A:
    """
    >>> A.__init__.__doc__
    'A.__init__ docstring'
    >>> A.__len__.__doc__
    'A.__len__ docstring'
    >>> A.__add__.__doc__
    'A.__add__ docstring'
    >>> A.__getattr__.__doc__
    'A.__getattr__ docstring'
    """
    def __init__(self):
        "A.__init__ docstring"
    def __len__(self):
        "A.__len__ docstring"
    def __add__(self, other):
        "A.__add__ docstring"
    def __getattr__(self, name):
        "A.__getattr__ docstring"

cdef class B(A):
    """
    >>> B.__init__.__doc__
    'A.__init__ docstring'
    >>> B.__len__.__doc__
    'B.__len__ docstring'
    >>> B.__add__.__doc__
    'A.__add__ docstring'
    >>> B.__getattr__.__doc__
    'A.__getattr__ docstring'
    """
    def __len__(self):
        "B.__len__ docstring"

class C(A):
    """
    >>> C.__init__.__doc__
    'A.__init__ docstring'
    >>> C.__len__.__doc__
    'C.__len__ docstring'
    >>> C.__add__.__doc__
    'A.__add__ docstring'
    >>> C.__getattr__.__doc__
    'A.__getattr__ docstring'
    """
    def __len__(self):
        "C.__len__ docstring"