@@ -23,16 +23,16 @@ def __init__(self, inner_value):
23
23
object .__setattr__ (self , '_inner_value' , inner_value )
24
24
25
25
def __setattr__ (self , attr_name , attr_value ):
26
- """Makes inner state of the monads immutable."""
26
+ """Makes inner state of the containers immutable."""
27
27
raise ImmutableStateError ()
28
28
29
29
def __delattr__ (self , attr_name ): # noqa: Z434
30
- """Makes inner state of the monads immutable."""
30
+ """Makes inner state of the containers immutable."""
31
31
raise ImmutableStateError ()
32
32
33
33
def __str__ (self ):
34
34
"""Converts to string."""
35
- return '{0}: {1}' .format (
35
+ return '< {0}: {1}> ' .format (
36
36
self .__class__ .__qualname__ ,
37
37
str (self ._inner_value ),
38
38
)
@@ -52,9 +52,9 @@ class Container(_BaseContainer, metaclass=ABCMeta):
52
52
53
53
You won't create 'Container' instances directly.
54
54
Instead, sub-classes implement specific contexts.
55
- Monads allow you to bind together
55
+ containers allow you to bind together
56
56
a series of calculations while maintaining
57
- the context of that specific monad .
57
+ the context of that specific container .
58
58
59
59
This is an abstract class with the API declaration.
60
60
@@ -69,7 +69,7 @@ def map(self, function): # pragma: no cover
69
69
Applies 'function' to the contents of the functor.
70
70
71
71
And returns a new functor value.
72
- Works for monads that represent success.
72
+ Works for containers that represent success.
73
73
Is the opposite of :meth:`~fix`.
74
74
"""
75
75
raise NotImplementedError ()
@@ -79,8 +79,8 @@ def bind(self, function): # pragma: no cover
79
79
"""
80
80
Applies 'function' to the result of a previous calculation.
81
81
82
- And returns a new monad .
83
- Works for monads that represent success.
82
+ And returns a new container .
83
+ Works for containers that represent success.
84
84
Is the opposite of :meth:`~rescue`.
85
85
"""
86
86
raise NotImplementedError ()
@@ -91,7 +91,7 @@ def fix(self, function): # pragma: no cover
91
91
Applies 'function' to the contents of the functor.
92
92
93
93
And returns a new functor value.
94
- Works for monads that represent failure.
94
+ Works for containers that represent failure.
95
95
Is the opposite of :meth:`~map`.
96
96
"""
97
97
raise NotImplementedError ()
@@ -101,21 +101,21 @@ def rescue(self, function): # pragma: no cover
101
101
"""
102
102
Applies 'function' to the result of a previous calculation.
103
103
104
- And returns a new monad .
105
- Works for monads that represent failure.
104
+ And returns a new container .
105
+ Works for containers that represent failure.
106
106
Is the opposite of :meth:`~bind`.
107
107
"""
108
108
raise NotImplementedError ()
109
109
110
110
@abstractmethod
111
111
def value_or (self , default_value ): # pragma: no cover
112
- """Forces to unwrap value from monad or return a default."""
112
+ """Forces to unwrap value from container or return a default."""
113
113
raise NotImplementedError ()
114
114
115
115
@abstractmethod
116
116
def unwrap (self ): # pragma: no cover
117
117
"""
118
- Custom magic method to unwrap inner value from monad .
118
+ Custom magic method to unwrap inner value from container .
119
119
120
120
Should be redefined for ones that actually have values.
121
121
And for ones that raise an exception for no values.
@@ -127,7 +127,7 @@ def unwrap(self): # pragma: no cover
127
127
@abstractmethod
128
128
def failure (self ): # pragma: no cover
129
129
"""
130
- Custom magic method to unwrap inner value from the failed monad .
130
+ Custom magic method to unwrap inner value from the failed container .
131
131
132
132
This method is the opposite of :meth:`~unwrap`.
133
133
"""
@@ -136,7 +136,7 @@ def failure(self): # pragma: no cover
136
136
137
137
class GenericContainerOneSlot (Generic [_ValueType ], Container ):
138
138
"""
139
- Base class for monads with one typed slot.
139
+ Base class for containers with one typed slot.
140
140
141
141
Use this type for generic inheritance only.
142
142
Use :class:`~Container` as a general type for polymorphism.
@@ -145,7 +145,7 @@ class GenericContainerOneSlot(Generic[_ValueType], Container):
145
145
146
146
class GenericContainerTwoSlots (Generic [_ValueType , _ErrorType ], Container ):
147
147
"""
148
- Base class for monads with two typed slot.
148
+ Base class for containers with two typed slot.
149
149
150
150
Use this type for generic inheritance only.
151
151
Use :class:`~Container` as a general type for polymorphism.
0 commit comments