justpy icon indicating copy to clipboard operation
justpy copied to clipboard

Unclear use of Async on Input Component page of Tutorial

Open garyrob opened this issue 4 years ago • 1 comments

The Input Component page of the Tutorial uses async def instead of def in several examples. But it doesn't explain why, and when I edit out the async keyword, I get exactly the same results as when I include it. It makes no discernable difference at all.

It seems like either the examples shouldn't use async there, or some explanation should be provided.

garyrob avatar Dec 27 '20 21:12 garyrob

You are right, in these examples they make no difference and should be left out. It is best to use async when the event handler is required to do some i/o and it should be done in a non-blocking way. Here is an example: https://justpy.io/tutorial/request_object/#dog-example-with-image-click

elimintz avatar Dec 28 '20 04:12 elimintz