October 2018
Intermediate to advanced
420 pages
10h 26m
English
The last small thing that prevents RxPY code from being as readable as synchronous procedural code is the usage of backslashes for continuation lines. When an operator chain is quite small, like in the previous examples, then using backslashes is natural. However, it becomes a visual distraction when longer operator chains are used. The easy way to fix this is to wrap expressions in parentheses. Since line continuation is implicit inside an open parenthesis, there is no need to add backslashes.
Moreover, comments are allowed inside the parentheses. This allows us to finally write the code snippet this way:
from collections import namedtupleBasket = namedtuple('Basket', ['count', 'what'])FruitCount = namedtuple('FruitCount', ...