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 @@ -1944,9 +1944,12 @@ Notes on using *__slots__*
1944
1944
* Nonempty *__slots__ * does not work for classes derived from "variable-length"
1945
1945
built-in types such as :class: `int `, :class: `bytes ` and :class: `tuple `.
1946
1946
1947
- * Any non-string iterable may be assigned to *__slots__ *. Mappings may also be
1948
- used; however, in the future, special meaning may be assigned to the values
1949
- corresponding to each key.
1947
+ * Any non-string :term: `iterable ` may be assigned to *__slots__ *.
1948
+
1949
+ * If a :class: `dictionary <dict> ` is used to assign *__slots__ *, the dictionary
1950
+ keys will be used as the slot names. The values of the dictionary can be used
1951
+ to provide per-attribute docstrings that will be recognised by
1952
+ :func: `inspect.getdoc ` and displayed in the output of :func: `help `.
1950
1953
1951
1954
* :attr: `~instance.__class__ ` assignment works only if both classes have the
1952
1955
same *__slots__ *.
You can’t perform that action at this time.
0 commit comments