Ticket #74 (closed defect: fixed)

Opened 22 months ago

Last modified 22 months ago

athomas' "emulating ActionScript with statement" is broken

Reported by: aleaxit@… Owned by: athomas
Priority: major Component: bpkg
Severity: critical Keywords:
Cc:

Description (last modified by athomas) (diff)

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

Changed 22 months ago by athomas

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)

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.

Changed 22 months ago by athomas

  • description modified (diff)

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

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.