|
1 | 1 | Exposing D classes to python
|
2 | 2 | ============================
|
3 | 3 |
|
4 |
| -The heart of PyD's class wrapping features is the `class_wrap` |
| 4 | +The heart of PyD's class wrapping features is the `class_wrap` |
5 | 5 | function template.
|
6 | 6 |
|
7 | 7 | Member wrapping
|
@@ -70,7 +70,7 @@ Specify whether property is read-only, write-only, or read-write.
|
70 | 70 |
|
71 | 71 | Possible values: :code:`"r"`, :code:`"w"`, :code:`"rw"`, :code:`""`
|
72 | 72 |
|
73 |
| -When :code:`""`, determine mode based on availability of getter and setter |
| 73 | +When :code:`""`, determine mode based on availability of getter and setter |
74 | 74 | forms.
|
75 | 75 |
|
76 | 76 | Default: :code:`""`
|
@@ -105,29 +105,29 @@ Operator
|
105 | 105 | Notes on wrapped operators
|
106 | 106 | * only one overload is permitted per operator; however OpBinary and OpBinaryRight may "share" an operator.
|
107 | 107 | * PyD only supports opSlice, opSliceAssign if both of their two indices are
|
108 |
| - implicitly convertable to Py_ssize_t. This is a limitation of the |
109 |
| - Python/C API. Note this means the zero-argument form of opSlice |
| 108 | + implicitly convertable to Py_ssize_t. This is a limitation of the |
| 109 | + Python/C API. Note this means the zero-argument form of opSlice |
110 | 110 | (:code:`foo[]`) cannot be wrapped.
|
111 |
| - * :code:`~`, :code:`~=`: Python does not have a dedicated array |
112 |
| - concatenation operator. |
113 |
| - :code:`+` is reused for this purpose. Therefore, odd behavior may result |
| 111 | + * :code:`~`, :code:`~=`: Python does not have a dedicated array |
| 112 | + concatenation operator. |
| 113 | + :code:`+` is reused for this purpose. Therefore, odd behavior may result |
114 | 114 | with classes that overload both :code:`+` and :code:`~`. The Python/C API
|
115 |
| - does consider addition and concantenation to be distinct operations, |
| 115 | + does consider addition and concantenation to be distinct operations, |
116 | 116 | though.
|
117 |
| - * :code:`in`: Semantics vary slightly. In python, :code:`in` is a |
118 |
| - containment test and retursn a bool. In D, by convention |
| 117 | + * :code:`in`: Semantics vary slightly. In python, :code:`in` is a |
| 118 | + containment test and retursn a bool. In D, by convention |
119 | 119 | :code:`in` is a lookup, returning a pointer or null. PyD will check the
|
120 | 120 | boolean result of a call to the overload and return that value to Python.
|
121 | 121 |
|
122 | 122 |
|
123 | 123 | Iterator wrapping
|
124 | 124 | -----------------
|
125 | 125 |
|
126 |
| -A wrapped class can be make iterable in python by supplying defs with the |
| 126 | +A wrapped class can be make iterable in python by supplying defs with the |
127 | 127 | python names:
|
128 | 128 |
|
129 | 129 | * :code:`__iter__`, which should return :code:`this`.
|
130 |
| - * :code:`next`, which should return the next item, or null to signal |
| 130 | + * :code:`next`, which should return the next item, or null to signal |
131 | 131 | termination. Signature must be :code:`PyObject* next()`.
|
132 | 132 |
|
133 | 133 | Alternatively, you can supply a single :code:`__iter__` that returns a Range.
|
0 commit comments