Skip to content

Commit cc25cd9

Browse files
committed
Add a tip about the returned receiver type for map()
Recommend saving a reference to the original receiver if users need to access methods that are not part of the `Receiver` interface. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 7ff8e06 commit cc25cd9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/frequenz/channels/_receiver.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ async def receive(self) -> _T_co:
228228
def map(self, call: Callable[[_T_co], _U_co]) -> Receiver[_U_co]:
229229
"""Return a receiver with `call` applied on incoming messages.
230230
231+
Tip:
232+
The returned receiver type won't have all the methods of the original
233+
receiver. If you need to access methods of the original receiver that are
234+
not part of the `Receiver` interface you should save a reference to the
235+
original receiver and use that instead.
236+
231237
Args:
232238
call: function to apply on incoming messages.
233239

0 commit comments

Comments
 (0)