English
Open in Telegram

ThreadI was some days researching about improve my PYthon code to speed up, so i choosed the async code, there it say, even i …

6 messages · –
N
I was some days researching about improve my PYthon code to speed up, so i choosed the async code, there it say, even i normally use, await fun_name() await 2nd_fun_name() in a async function, still the 2nd fun start after the first one is finish, is this correct thinking of me? Another thigns they say i need to use the, asyncio.create_taask(function_name, args,) asyncio.create_task(2nd_fun_name, args, ...) and now my both function will start here at same time not depends on the first fun to finish, is this right or not? and now they say to use asyncio.TaskGroup !!! I got confused in the part what should i use in reality 2nd option i think better ??? any sugession 🙏
  1. G
    you can use any you want, its kinda well explained in the docs, gather and TaskGroups have their uses. With gather you can control the exceptions better than TaskGroup if cancellation is something that bothers you.
  2. C
    Did synchronous code slow it down?
    1. N
      yaa, i am doing sending a network request in one fun, another fun do open playwright and do take screenshot of the page, so it is slow down, so i want ot use async and do both together thats why i found i must need to use asyncio, is nto this i got wrong or not?
      1. C
        I'm not convinced that your issue was synchronous code just yet. The thing with "synchronous" code is that it doesn't always mean sequential. There are still threads and processes. And depending on which one's you've used, it might have been just fine.

An open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · Index limits · Remove a page · Catalog · Search · How we count