You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, `object`, i.e. `PyAny` is used as the base class.
414
413
To override this default, use the `extends` parameter for `pyclass` with the full path to the base class.
415
414
Currently, only classes defined in Rust and builtins provided by PyO3 can be inherited from; inheriting from other classes defined in Python is not yet supported ([#991](https://github.com/PyO3/pyo3/issues/991)).
416
415
417
-
For convenience, `(T, U)` implements `Into<PyClassInitializer<T>>` where `U` is the base class of `T`.
418
-
But for a more deeply nested inheritance, you have to return `PyClassInitializer<T>` explicitly.
416
+
To initialize a class, which inherits from another class, use the `PyClassInitializer` API.
419
417
420
418
To get a parent class from a child, use [`PyRef`] instead of `&self` for methods, or [`PyRefMut`] instead of `&mut self`.
421
419
Then you can access a parent class by `self_.as_super()` as `&PyRef<Self::BaseClass>`, or by `self_.into_super()` as `PyRef<Self::BaseClass>` (and similar for the `PyRefMut` case).
0 commit comments