@@ -42,45 +42,51 @@ from ResultContainer import Result, Ok, Err
4242 - ` value ` is wrapped within an ` Ok ` .
4343 - Constructor: ` Result.as_Ok(value) `
4444 - ` Result.Ok ` attribute returns the wrapped ` value `
45+
4546- ` Err(e) `
4647 - ` e ` is a ` ResultErr ` object wrapped within an ` Err ` .
4748 - Constructor: ` Result.as_Err(error_msg) `
4849 - ` Result.Err ` attribute returns the wrapped ` e ` .
4950
50-
5151### Properties of the ` Result ` Variants
5252
5353#### ` Ok(value) `
5454
55- - Represents success (non-error state).
56- The ` value ` is wrapped within the ` Ok() ` .
55+ - Represents success (non-error state). The ` value ` is wrapped within the ` Ok() ` .
56+
5757- Can be initialized with ` Ok(value) `
5858 - ` Ok(value) `   ; ➥  ; syntactic-sugar for   ; ➥  ; ` Result.as_Ok(value) `
59+
5960- Math operations are redirected to ` value ` and rewrap the solution or concatenate the errors.
6061 - ` Ok(value1) + Ok(value2) `   ;   ; ➣   ; ` Ok(value1 + value2) `
61- - ` Ok(value1) + Err(e) `   ;   ; ➣   ; ` Err(e + "a + b with b as Err") `
62- - ` Err(e1) + Err(e2) `   ;   ;   ;   ; ➣   ; ` Err(e1 + "a + b with a and b as Err.") `
62+ - ` Ok(value1) + Err(e) `   ;   ;   ;   ;   ; ➣   ; ` Err(e + "a + b with b as Err") `
63+ - ` Err(e1) + Err(e2) `   ;   ;   ;   ;   ;   ;   ; ➣   ; ` Err(e1 + "a + b with a and b as Err.") `
64+
6365- All attributes and methods not associated with ` Result ` are redirected to ` value ` .
6466 - ` Ok(value).method() ` is equivalent to ` Ok(value.method()) ` and
6567 ` Ok(value).attrib ` is equivalent to ` Ok(value.attrib) ` .
6668 - ` Ok(value).raises() ` does NOT become ` Ok(value.raises()) `
67- because ` Result.raises() ` is a native ` Result ` method.
68- - Comparisons redirect to comparing the wrapped ` value ` if ` Ok ` . But mixed comparisons assume:
69- ` Err(e) < Ok(value) ` and ` Err(e1) == Err(e2) ` for any ` value ` , ` e ` , ` e1 ` , and ` e2 ` .
70- - ` Ok(value1) < Ok(value2) `   ;   ; ➣   ; ` value1 < value `
71- - ` Err(e) < Ok(value2) `   ; ➣   ; ` True `
72- - ` Ok(value1) < Err(e) `   ; ➣   ; ` False `
73- - ` Err(e1) < Err(e2) `   ; ➣   ; ` False `
74- - ` Err(e1) <= Err(e2) `   ; ➣   ; ` True `
69+ because ` Result.raises() ` is a native ` Result ` method.
70+
71+ - Comparisons redirect to comparing the wrapped ` value ` if ` Ok ` .
72+ But mixed comparisons assume:
73+ ` Err(e1) < Ok(value) ` and ` Err(e1) == Err(e2) ` for any ` value ` , ` e1 ` , and ` e2 ` .
74+ - ` Ok(value1) <= Ok(value2) ` ➣ ` value1 <= value2 `
75+ - ` Ok(value1) < Ok(value2) ` ➣ ` value1 < value2 `
76+ - ` Err(e1) < Ok(value2) ` ➣ ` True `
77+ - ` Ok(value1) < Err(e1) ` ➣ ` False `
78+ - ` Err(e1) < Err(e2) ` ➣ ` False `
79+ - ` Err(e1) <= Err(e2) ` ➣ ` True `
7580
7681#### ` Err(e) ` :
7782
78- - Represents a failure (error-state) and contains ` e ` as a ` ResultErr ` object
79- that stores error messages and traceback information.
83+ - Represents a failure (error-state) and contains ` e ` as a ` ResultErr ` object that stores error messages and traceback information.
84+
8085- Can be initialized with ` Err(error_msg) `
8186 - ` Err(e) `   ; ➥  ; syntactic-sugar for   ; ➥  ; ` Result.as_Err(e) `
8287
8388- If an ` Ok(value) ` operation fails, then it is converted to an ` Err(e) ` , where ` e ` stores the error message.
89+
8490- Any operation on ` Err(e) ` results in another error message being appended to ` e ` .
8591
8692There are methods built into ` Result ` to check if an error has been raised, or the unwrap the value/error to get its contents.
0 commit comments