Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

The difference is the FLAG_REF which is set to 128 (0x80). 

>>> import marshal
>>> var_example = [(1,2,3),(4,5,6)]
>>> vm = marshal.dumps(var_example)
>>> rm = marshal.dumps([(1,2,3),(4,5,6)])
>>> [v ^ r for v, r in zip(vm, rm)]
[128, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Whether a flag for possible reuse is generated depends on the reference count 
of a object.

When passing in the list as variable, the reference count is higher than 
passing it as a literal.


 That flag tells marshal whether to generate an index entry.  Whether that 
occurs re

----------
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46900>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to