Ticket #74 (closed defect: fixed)
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
Note: See
TracTickets for help on using
tickets.
