line continuations with backslash
Bengt Richter
bokr at accessone.com
Mon Aug 27 22:22:34 EDT 2001
On 27 Aug 2001 13:44:02 -0700, Paul Rubin <phr-n2001 at nightsong.com> wrote:
>bokr at accessone.com (Bengt Richter) writes:
>> >>> dis.dis(compile("'123' '456'",'','eval'))
>> 0 SET_LINENO 0
>> 3 LOAD_CONST 0 ('123456')
>> 6 RETURN_VALUE
>> >>> marshal.dumps(compile("'123' '456'",'','eval'))
>> 'c\x00\x00\x00\x00\x01\x00\x00\x00s\x07\x00\x00\x00\x7f\x00\x00d\x00\x00S(\x01\x00\x00\x00
>> s\x06\x00\x00\x00123456(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x0
>> 0s\x00\x00\x00\x00s\x01\x00\x00\x00?\x00\x00s\x00\x00\x00\x00'
>> >>>
>>
>> The '123' '456' seems to be folded in the tokenizer,
>> not passed on as tokens for a join op.
>
>Yes, that's fine. But '123456' still takes 6 bytes. Marshalled as a
>long int, it would take just over 2 bytes (obviously there would be some
>unused bits, but remember that we're actually talking about much longer
>numbers, like 300 digits).
Maybe this?
>>> dis.dis(compile(`long('123' '456')`, '', 'eval'))
0 SET_LINENO 0
3 LOAD_CONST 0 (123456L)
6 RETURN_VALUE
More information about the Python-list
mailing list