DISQUS

SIGUSR2: SIGUSR2 > Python Worlds

  • mitch · 2 months ago
    My solution is a little bit more hackish, but more usable imo. Not thoroughly tested though, might have some implications I haven't thought of.

    http://pastebin.com/m7cc84252
  • Andrew Gwozdziewycz · 2 months ago
    I certainly thought about using deepcopy for this, but ultimately went for simplicity. I think I'll explore your solution a bit, since I think there are some valid usability things in it. Thanks for the ideas!
  • llimllib · 2 months ago
    I'm pretty sure that all this dodgy with-hacking indicates a real need for a new language construct.

    That's not an insult, by the way, super neat hack.
  • Andrew Gwozdziewycz · 2 months ago
    I think deep down I want Python to be as flexible as my favorite language Scheme, and unfortunately it isn't. However, the with-statement actually has some interesting, DSL-like properties with it, which is the reason it gets exploited the way it does. It's definitely the reason *I* try to exploit it.

    Unfortunately for with-hackers, the sad reality is that Guido and the Gang probably aren't ever going to give us more bendability in the language, which means that with-hacking maybe our only chance to create it.

    Of course I'd welcome any sort of new constructs that can be bent, but I'd rather have TCO, or multi-line lambdas instead.