mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 06:35:12 +00:00
Change __init__(self) to __new__(cls)
__init__(self) cannot return values. According to https://stackoverflow.com/questions/2491819/how-to-return-a-value-from-init-in-python __new__(cls) should be used, which works.
This commit is contained in:
parent
5088364b96
commit
9ed8b44033
@ -23,7 +23,7 @@ The following Python snippet demonstrates the intended usage from the Python sid
|
||||
.. code-block:: python
|
||||
|
||||
class A:
|
||||
def __int__(self):
|
||||
def __new__(cls):
|
||||
return 123
|
||||
|
||||
from example import print
|
||||
|
Loading…
Reference in New Issue
Block a user