GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Monday, 06-May-2024 13:46:21 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧

    wrote some CPython code today

    In conversation Monday, 06-May-2024 13:46:21 JST from mastodon.social permalink

    Attachments


    1. https://files.mastodon.social/media_attachments/files/112/387/363/536/884/621/original/2116472af4197bf1.png
    • Embed this notice
      val (val@oc.todon.fr)'s status on Monday, 06-May-2024 13:46:20 JST val val
      in reply to

      @whitequark wakers[:] = (waker for waker in wakers if waker(*va_args))

      In conversation Monday, 06-May-2024 13:46:20 JST permalink
      clacke likes this.
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Monday, 06-May-2024 13:46:21 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      figured out how to improve it

      In conversation Monday, 06-May-2024 13:46:21 JST permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/112/387/371/253/390/671/original/aa7492e72edec17f.png
      clacke likes this.
    • Embed this notice
      clacke (clacke@libranet.de)'s status on Monday, 06-May-2024 13:46:24 JST clacke clacke
      in reply to
      • val
      @val @whitequark You mean it becomes equivalent to `wakers[:] = [waker for waker in wakers if waker(*va_args)]`?
      In conversation Monday, 06-May-2024 13:46:24 JST permalink
    • Embed this notice
      val (val@oc.todon.fr)'s status on Monday, 06-May-2024 13:46:26 JST val val
      in reply to

      @whitequark indeed, it looks like this materializes the iterable: https://github.com/python/cpython/blob/c7c9b913c01afb8d2ff4048f82155969f7ef75b1/Objects/listobject.c#L891

      sad

      In conversation Monday, 06-May-2024 13:46:26 JST permalink

      Attachments

      1. Domain not in remote thumbnail source whitelist: opengraph.githubassets.com
        cpython/Objects/listobject.c at c7c9b913c01afb8d2ff4048f82155969f7ef75b1 · python/cpython
        The Python programming language. Contribute to python/cpython development by creating an account on GitHub.
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Monday, 06-May-2024 13:46:27 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to
      • val

      @val actually I don't think that can be the case, or it would break whenever you expand the list

      In conversation Monday, 06-May-2024 13:46:27 JST permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Monday, 06-May-2024 13:46:29 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to
      • val

      @val oh, interesting! this does basically the same amount of allocation, right?

      In conversation Monday, 06-May-2024 13:46:29 JST permalink
    • Embed this notice
      val (val@oc.todon.fr)'s status on Monday, 06-May-2024 13:46:29 JST val val
      in reply to

      @whitequark probably, yes

      In conversation Monday, 06-May-2024 13:46:29 JST permalink
    • Embed this notice
      Steven Reed (srtcd424@mas.to)'s status on Monday, 06-May-2024 13:46:34 JST Steven Reed Steven Reed
      in reply to

      @whitequark OT: my brain is apparently incapable of not reading "wakers" as a slightly differently spelled noun..

      In conversation Monday, 06-May-2024 13:46:34 JST permalink
      clacke likes this.
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Monday, 06-May-2024 13:46:39 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to
      • sanfierro

      @sanfierro yes

      i'm making a kind of obscure joke where i took some Python that reads similar to C code, and made it look a bit more like C code

      In conversation Monday, 06-May-2024 13:46:39 JST permalink
      clacke likes this.
    • Embed this notice
      sanfierro (sanfierro@pony.social)'s status on Monday, 06-May-2024 13:46:40 JST sanfierro sanfierro
      in reply to

      @whitequark
      > va_args
      I think I've seen this somewhere, perhaps C?
      Also, I think you've just shown me what wakers are, but I still don't fully understand

      In conversation Monday, 06-May-2024 13:46:40 JST permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Monday, 06-May-2024 13:46:54 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to
      • clacke
      • val

      @clacke @val it's probably somewhat slower

      In conversation Monday, 06-May-2024 13:46:54 JST permalink
    • Embed this notice
      clacke (clacke@libranet.de)'s status on Monday, 06-May-2024 13:46:54 JST clacke clacke
      in reply to
      • val

      Yeah, there are more objects created and I imagine the generator protocol calls aren't cheap.

      Oops also it would break if the filtered list were empty. Guarding it by adding index = -1 before removes the golf benefit.

      Once again, explicit is better.

      @whitequark @val

      In conversation Monday, 06-May-2024 13:46:54 JST permalink
    • Embed this notice
      clacke (clacke@libranet.de)'s status on Monday, 06-May-2024 13:46:55 JST clacke clacke
      in reply to
      • val

      @whitequark This should have the same memory properties as the original:

      for index, waker in enumerate(waker for waker in wakers if waker(*args)): wakers[index] = waker del wakers[index + 1:]Not sure if it's more readable or if I'm just liner golfing. I'm also not thrilled with using index outside the loop, I actually wish that wouldn't be in scope.

      @val

      In conversation Monday, 06-May-2024 13:46:55 JST permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Monday, 06-May-2024 13:46:56 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to
      • clacke
      • val

      @clacke @val basically yes, as far as i can tell from the code

      In conversation Monday, 06-May-2024 13:46:56 JST permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.