Live data from Hacker News

Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

mergify.com

21–30 of 79 posts

Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

#21
My New Year’s Resolution will be to give up complaining about this on hn, but for now:

I find ChatGPT’s style and tone condescending and bland to the point of obfuscating whatever was unique, thoughtful and insightful in the original prompt.

Trying to reverse-engineer the “Not this: That!” phrasing, artificial narrative drama & bizarre use of emphasis to recapture that insight and thought is not something I’m at all enthusiastic to do.

Perhaps a middle ground: HN could support a “prompt” link to the actual creative seed?

Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

#23
For anyone somewhat interested in task & scheduling I highly recommend phil-op tutorial on building a kernel - there is a late branch on the github that specifically focus on asynchronous task - I implemented multi-core this week and it high a profound enlightenment on what the f* was actually going on. This is something Claude / Gemini helped me achieve so I didn't require me to spend nights on kernel debugging methodology & documentation ; Best experience I could get on async

Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

#24

This is gold. Here’s a horror story for you. A few years ago I worked for this startup as a principal engineer. The engineering manager kept touting how he was from XYZ and that he ran Pythonista meetups and how vast his knowledge of Python was. We were building a security product and needed to scan hundreds of thousands of documents quickly so we built a fan out with coroutines. I came on board well into this effort…

Classic. I had a similar run-in with the CTO of a company a decade or so ago who point blank refused to use version control for the source code. He insisted on having directories that got zipped and passed around from developer to developer and good luck figuring out how to integrate someone else's changes.

I won that particular battle but it was uphill all the way, at least he had the grace to afterwards admit that he'd been an idiot.

Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

#25

My New Year’s Resolution will be to give up complaining about this on hn, but for now: I find ChatGPT’s style and tone condescending and bland to the point of obfuscating whatever was unique, thoughtful and insightful in the original prompt. Trying to reverse-engineer the “Not this: That!” phrasing, artificial narrative drama & bizarre use of emphasis to recapture that insight and thought is not something I’m at all…

Are you saying this was generated by ChatGPT? It didn't seem that way to me at all... what gave that away to you?

Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

#26
> Awaiting a coroutine does not give control back to the event loop.

I think this is a subtler point than one might think on first read, which is muddled due to the poorly chosen examples.

Here's a better illustration:

  import asyncio
  
  async def child():
      print("child start")
      await asyncio.sleep(0)
      print("child end")
  
  async def parent():
      print("parent before")
      await child()        # 
It prints:

  other
  parent before
  child start
  other
  child end
  parent after
  other
  other
  other
So the author's point is that "other" can never appear in-between "parent before" and "child start".

Edit: clarification

Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

#28

This is gold. Here’s a horror story for you. A few years ago I worked for this startup as a principal engineer. The engineering manager kept touting how he was from XYZ and that he ran Pythonista meetups and how vast his knowledge of Python was. We were building a security product and needed to scan hundreds of thousands of documents quickly so we built a fan out with coroutines. I came on board well into this effort…

Classic. I had a similar run-in with the CTO of a company a decade or so ago who point blank refused to use version control for the source code. He insisted on having directories that got zipped and passed around from developer to developer and good luck figuring out how to integrate someone else's changes. I won that particular battle but it was uphill all the way, at least he had the grace to afterwards admit that…

That is a very different run in.

Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks

#30

My New Year’s Resolution will be to give up complaining about this on hn, but for now: I find ChatGPT’s style and tone condescending and bland to the point of obfuscating whatever was unique, thoughtful and insightful in the original prompt. Trying to reverse-engineer the “Not this: That!” phrasing, artificial narrative drama & bizarre use of emphasis to recapture that insight and thought is not something I’m at all…

Are you saying this was generated by ChatGPT? It didn't seem that way to me at all... what gave that away to you?

Are you being sarcastic? If not it’s obvious once you’ve seen it often enough.
Post reply on HN