File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,6 +303,41 @@ class MenuConfig(NamedTuple):
303303
304304def create_menu (config : MenuConfig):
305305 title, body, button_text, cancellable = config
306+ # ...
307+
308+
309+ create_menu(
310+ MenuConfig(
311+ title = " My delicious menu" ,
312+ body = " A description of the various items on the menu" ,
313+ button_text = " Order now!"
314+ )
315+ )
316+ ```
317+
318+ ** Even fancier**
319+ ``` python
320+ from dataclasses import astuple, dataclass
321+
322+
323+ @dataclass
324+ class MenuConfig :
325+ """ A configuration for the Menu.
326+
327+ Attributes:
328+ title: The title of the Menu.
329+ body: The body of the Menu.
330+ button_text: The text for the button label.
331+ cancellable: Can it be cancelled?
332+ """
333+ title: str
334+ body: str
335+ button_text: str
336+ cancellable: bool = False
337+
338+ def create_menu (config : MenuConfig):
339+ title, body, button_text, cancellable = astuple(config)
340+ # ...
306341
307342
308343create_menu(
You can’t perform that action at this time.
0 commit comments