ASYNC file I/O in Python

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

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

  • @Indently
    @Indently 9 месяцев назад

    I love the auto-generated captions!
    "aero-files"
    "AOL-files"

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

    Btw what is the best way to use postgres asynchronously?

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

      Asyncpg is your best bet I believe.

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

    Just a dumb question. But what are the benefits? Am I understanding this right that when I write to this file a few GB data the program continues it's run and will not hang until the data is written? And what if I need to write into the file from another function but the file is still written to?

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

      1) Pretty much right. It's basically so you don't block async applications. 2) You'd need to handle that yourself.

    • @mr.vladislav5746
      @mr.vladislav5746 Год назад

      @@Carberra What? Doesn't the await keyword make it wait anyway, so the program *doesn't* continue execution? Or did I misunderstand async. Isn't this only beneficial if we read/write many files at once, and then await them all at the same time?

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

      You've misunderstood, though the terminology is a bit odd with the whole "await" thing. I did a video a little while that better explains async (ruclips.net/video/vLbZUVKFVxY/видео.html). Aiofiles specifically is probably most beneficial in something like a bot, or some other service that's running 24/7.