File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1877,9 +1877,12 @@ Notes on using *__slots__*
1877
1877
* Nonempty *__slots__ * does not work for classes derived from "variable-length"
1878
1878
built-in types such as :class: `int `, :class: `bytes ` and :class: `tuple `.
1879
1879
1880
- * Any non-string iterable may be assigned to *__slots__ *. Mappings may also be
1881
- used; however, in the future, special meaning may be assigned to the values
1882
- corresponding to each key.
1880
+ * Any non-string :term: `iterable ` may be assigned to *__slots__ *.
1881
+
1882
+ * If a :class: `dictionary <dict> ` is used to assign *__slots__ *, the dictionary
1883
+ keys will be used as the slot names. The values of the dictionary can be used
1884
+ to provide per-attribute docstrings that will be recognised by
1885
+ :func: `inspect.getdoc ` and displayed in the output of :func: `help `.
1883
1886
1884
1887
* :attr: `~instance.__class__ ` assignment works only if both classes have the
1885
1888
same *__slots__ *.
You can’t perform that action at this time.
0 commit comments