From 3dc28579ef0d429430b2d035837acd9b1828b7c8 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Fri, 10 Jun 2022 15:10:33 +0200 Subject: [PATCH] ubuiltins: Document bool, complex. --- src/ubuiltins/__init__.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ubuiltins/__init__.py b/src/ubuiltins/__init__.py index 3f363fa..ed3812f 100644 --- a/src/ubuiltins/__init__.py +++ b/src/ubuiltins/__init__.py @@ -141,14 +141,19 @@ class bool: def __init__(self, *args) -> None: """ + bool(​) + bool(x) + Creates a boolean value, which is either ``True`` or ``False``. + The input value is converted using the standard truth testing + procedure. If no input is given, it is assumed to be ``False``. + Arguments: - x: Value that is tested for being ``True`` or ``False``. It is - converted using the standard truth testing procedure. + x: Value to be converted. Returns: - Result of the truth-test. If no object is given, it returns ``False``. + Result of the truth-test. """ @@ -265,9 +270,9 @@ class complex: ... def __init__(self, *args) -> None: - """complex() - complex(string: str) - complex(a: Union[float, complex], b: Union[float, complex] = 0) + """ + complex(string) + complex(a=0, b=0) Creates a complex number from a string or from a pair of numbers. @@ -276,12 +281,12 @@ class complex: 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. + string (str): A string of the form ``'1+2j'`` . + a (float or complex): A real-valued or complex number. + b (float or complex): A real-valued or complex number. Returns: - Complex number, obtained from the string or as the result of ``a + b * j``. + The resulting complex number. """