line continuations with backslash

Paul Rubin phr-n2001 at nightsong.com
Mon Aug 27 22:44:02 CEST 2001


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).



More information about the Python-list mailing list