Message380045
co_consts are merged already, but I forget about code attributes other than co_consts.
Duplication ratio is vary by code style, but in case of logging, we can reduce 25% of them.
```
>>> data = open('Lib/logging/__pycache__/__init__.python-310.pyc', 'rb').read()
>>> import marshal
>>> x = []
>>> def walk(c):
... x.append(c.co_code)
... x.append(c.co_lnotab)
... for cc in c.co_consts:
... if hasattr(cc, 'co_code'):
... walk(cc)
...
>>> code = marshal.loads(data[16:])
>>> walk(code)
>>> len(x)
336
>>> len(set(x))
249
>>> 249/336
0.7410714285714286
``` |
|
Date |
User |
Action |
Args |
2020-10-31 07:50:02 | methane | set | recipients:
+ methane |
2020-10-31 07:50:02 | methane | set | messageid: <1604130602.05.0.173247705477.issue42217@roundup.psfhosted.org> |
2020-10-31 07:50:01 | methane | link | issue42217 messages |
2020-10-31 07:50:01 | methane | create | |
|