Async TaskGroups are brand new and INSANELY USEFUL

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 17

  • @Indently
    @Indently 2 года назад +7

    I do miss the option to return the values that did succeed though, "returns_exceptions=True" was quite nice.

    • @Carberra
      @Carberra  2 года назад

      You can still use the old system where needed -- they may add some features to task groups to incorporate some old functionality where deemed fit.

  • @PanduPoluan
    @PanduPoluan Год назад +1

    5:32 the reason why the arrows pointed to the range() function for the float parameter error is because the error is raised by range(). Wherein the prior error with the string parameter is raised by str.__add__()

  • @TheMightyWej
    @TheMightyWej Год назад

    Great video, just starting out learning to use Async in python. Can I ask why you have the "await asyncio.sleep(0)" at the bottom of the count function? If it is waiting for zero seconds, would you not be able to run the function with it removed?

    • @Carberra
      @Carberra  Год назад

      Thank you! That's somewhat of an idiom -- it passes off to another coroutine if available (like it would of you slept for any non-zero amount of time), but makes that coroutine available to go back to immediately.

  • @SP-db6sh
    @SP-db6sh Год назад

    How to manage different task group, like tg1, tg2, tg3:
    tg1 for getting data from api
    tg2 for data validation
    tg3 : depending on tq2 response, tg3 will send another api request.

  • @vatsalpatel1711
    @vatsalpatel1711 Год назад

    how do you get all those emojis on the terminal looks great !!!

    • @Carberra
      @Carberra  Год назад

      I actually have a video which should help you out (: ruclips.net/video/4RuGK3w6Mbs/видео.html

  • @genemys
    @genemys Год назад

    in your example if you did await count(5); await count(10) it would achieve the same thing with fewer lines

    • @Carberra
      @Carberra  Год назад +2

      Using semi-colons like that isn't especially Pythonic, at least in my opinion. I tend to spreading out over multiple lines.

    • @vyrp
      @vyrp 3 месяца назад

      Wouldn't `await count(5); await count(10)` give a different result than the one in the video?
      The code proposed in the comment would print first all values from 1 to 5 *then* all values from 1 to 10.
      The code in the video interleaves both sequences.

  • @0xDEAD_Inside
    @0xDEAD_Inside 2 года назад

    Nice!

  • @m.acie.k
    @m.acie.k 2 года назад

    What's that VSC theme?

    • @thatrand0mnpc
      @thatrand0mnpc 2 года назад +1

      Looks like ayu

    • @Carberra
      @Carberra  2 года назад +1

      It is indeed Ayu. There a link in the description of you wanna know more (:

  • @sairamkumar6711
    @sairamkumar6711 Год назад

    raise me from None lol