Changes since version 0.6: |
Changes since version 0.6: |
|
|
* Experimental Python 3 support, including emulation of restored |
* Experimental Python 3 support, including emulation of restored |
``BINARY_DIVIDE`` and ``UNARY_CONVERT`` functions. |
``BINARY_DIVIDE``, ``UNARY_CONVERT``, and ``SLICE_#`` opcodes. |
|
|
Changes since version 0.5.2: |
Changes since version 0.5.2: |
|
|
>>> const_value(Local('x')) |
>>> const_value(Local('x')) |
Traceback (most recent call last): |
Traceback (most recent call last): |
... |
... |
NotAConstant: Local('x') |
peak.util.assembler.NotAConstant: Local('x') |
|
|
Tuples of constants are recursively replaced by constant tuples:: |
Tuples of constants are recursively replaced by constant tuples:: |
|
|
>>> const_value( (1,Global('y')) ) |
>>> const_value( (1,Global('y')) ) |
Traceback (most recent call last): |
Traceback (most recent call last): |
... |
... |
NotAConstant: Global('y') |
peak.util.assembler.NotAConstant: Global('y') |
|
|
As do any types not previously described here:: |
As do any types not previously described here:: |
|
|
>>> const_value([1,2]) |
>>> const_value([1,2]) |
Traceback (most recent call last): |
Traceback (most recent call last): |
... |
... |
NotAConstant: [1, 2] |
peak.util.assembler.NotAConstant: [1, 2] |
|
|
Unless of course they're wrapped with ``Const``:: |
Unless of course they're wrapped with ``Const``:: |
|
|
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP... |
LOAD_CONST 3 (2) |
LOAD_CONST 3 (2) |
JUMP_FORWARD L5 |
JUMP_FORWARD L5 |
L2: POP_TOP |
L2: POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP... |
LOAD_CONST 5 (3) |
LOAD_CONST 5 (3) |
JUMP_FORWARD L5 |
JUMP_FORWARD L5 |
L3: POP_TOP |
L3: POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP |
POP_TOP... |
LOAD_CONST 2 (<... 'type'>) |
LOAD_CONST 2 (<... 'type'>) |
ROT_TWO |
ROT_TWO |
CALL_FUNCTION 1 |
CALL_FUNCTION 1 |