HackerTrans
TopNewTrendsCommentsPastAskShowJobs

scribu

no profile record

Submissions

Apple Calls Out EU for Contradictory App Store Rules Under DSA and DMA

macrumors.com
2 points·by scribu·8 個月前·1 comments

comments

scribu
·8 個月前·discuss
> But isn't it true for JavaScript too?

You're right, the equivalent JS script produces the same sequence of outputs.

It turns out there is a way to emulate Python's asyncio.create_task().

Python:

  await asyncio.create_task(child())
JavaScript:

  const childTask = new Promise((resolve) => {
    setTimeout(() => child().then(resolve), 0)
  })
  await childTask
scribu
·8 個月前·discuss
> 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()        # <-- awaiting a coroutine (not a task)
      print("parent after")
  
  async def other():
      for _ in range(5):
          print("other")
          await asyncio.sleep(0)
  
  async def main():
      other_task = asyncio.create_task(other())
      parent_task = asyncio.create_task(parent())
      await asyncio.gather(other_task, parent_task)
      
  asyncio.run(main())

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
scribu
·11 個月前·discuss
ChatGPT Plus has that (used to be in the free tier too). You can toggle between versions for each of your messages with little left-right arrows.
scribu
·去年·discuss
The repo contains only the PDF, not actual runnable code for the RL training pipeline.

Publishing a high-level description of the training algorithm is good, but it doesn't count as "open-sourcing", as commonly understood.
scribu
·6 年前·discuss
> It provides too much data and insight to competitors.

I think being confident enough to publicize your cost structure might actually deter competitors. They'll look at it, realize they can't compete on cost and decide to pursue a different avenue.

The challenge is maintaining that cost-effectiveness as you grow.