Ticket #74 (closed defect: fixed)

Opened 6 months ago

Last modified 6 months ago

athomas' "emulating ActionScript with statement" is broken

Reported by: aleaxit@gmail.com Assigned to: athomas
Priority: major Component: bpkg
Severity: critical Keywords:
Cc:

Description (Last modified by athomas)

Only works in a GLOBAL scope, so the claims about "lexical" are wrong. Try adding to the wiki's code the function"

def f():
    import math
    with scope(math):
        print sqrt(9)

and call it -- it will fail miserably. Reason: a real locals() [[one for a function, not for a module!]] does NOT let you create local names in the fly (be that with .update or otherwise), the _compiler_ must know which names are in fact local to the function. Sorry if this ticket is misfiled but I saw no other way to communicate a comment that's very important, as the wikipage/blogpost may be very misleading to readers without a firm grasp of Python internals...!!!

Alex

Attachments

Change History

05/20/08 21:02:06 changed by athomas

  • status changed from new to closed.
  • resolution set to fixed.
  • description changed.

Hi Alex,

Thanks for the heads up. I had noticed the behaviour and alluded to it with the phrase "fairly major limitations", but you're right - that's not clear. I've updated the post accordingly.

Alec

PS. In lieu of an actual comment system, something I need to fix, tickets are fine.

05/20/08 21:02:19 changed by athomas

  • description changed.

Add/Change #74 (athomas' "emulating ActionScript with statement" is broken)




Change Properties
Action