Message141076
| Author |
lyricconch |
| Recipients |
lyricconch |
| Date |
2011年07月25日.07:36:46 |
| SpamBayes Score |
0.016849717 |
| Marked as misclassified |
No |
| Message-id |
<1311579407.7.0.367368454098.issue12635@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
use "as" for block scope support
just like mozilla javascript "let" extension
https://developer.mozilla.org/en/new_in_javascript_1.7#Block_scope_with_let_%28Merge_into_let_Statement%29
usage:
as_clause(as_declare): "as" NAME
as_stmt: NAME "as" test
as_expr: "(" expr "as" NAME ")" expr
var declare by as_clause is alive in <suite> only
eg:
<NAME "f" binding saved>with open(...) as f<NAME "f" bind to HEAPObj>:
...
<NAME "f" binding restored>
the same rule to "except E as e: "
spec:
from socket import AF_INET as IPv4
<IPv4 bind to socket.AF_INET slot>
IPv4 = None
assert socket.AF_INET == None
var in as_stmt is alive in current indentation
eg:
for i in range(10):
<NAME "t" binding saved>
t as f()+1 <NAME "t" bind to f()+1>
...
<NAME "t" binding restored>
var in as_expr is alive in sub expr only
eg:
t = None
x = (2+3 as t) t**2
assert t == None ane x == 25
Suggestion:
new opcode
ENTER_BLOCK #depth #varslots |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年07月25日 07:36:47 | lyricconch | set | recipients:
+ lyricconch |
| 2011年07月25日 07:36:47 | lyricconch | set | messageid: <1311579407.7.0.367368454098.issue12635@psf.upfronthosting.co.za> |
| 2011年07月25日 07:36:47 | lyricconch | link | issue12635 messages |
| 2011年07月25日 07:36:46 | lyricconch | create |
|