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:
Orell Garten 2020-04-21 15:02:55 +02:00 committed by Wenzel Jakob
parent 5088364b96
commit 9ed8b44033

View File

@ -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