mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
ubuiltins.complex: Document it.
Override typed docstrings in order to hide types like SupportsFloat and SupportsComplex. Avoid use of ``real`` and ``imag``, since both ``a`` and ``b`` can be either. Also reduce number of overloads by letting ``b`` default to 0, which is true in practice. See also https://github.com/pybricks/pybricks-api/issues/84
This commit is contained in:
@@ -231,9 +231,23 @@ class complex:
|
||||
...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
Returns a complex number with the value `real + imag*1j` or converts a
|
||||
string or number to a complex number.
|
||||
"""complex()
|
||||
complex(string: str)
|
||||
complex(a: Union[float, complex], b: Union[float, complex] = 0)
|
||||
|
||||
Creates a complex number from a string or from a pair of numbers.
|
||||
|
||||
If a string is given, it must be of the form ``'1+2j'``.
|
||||
If a pair of numbers is provided, the result is computed
|
||||
as: ``a + b * j``.
|
||||
|
||||
Arguments:
|
||||
string: A string of the form ``'1+2j'`` .
|
||||
a: A real-valued or complex number.
|
||||
b: A real-valued or complex number.
|
||||
|
||||
Returns:
|
||||
Complex number, obtained from the string or as the result of ``a + b * j``.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user