Message342915
> One issue with it is that in:
> def f():
> return " foo".dedent()
> f will have both " foo" and "foo" in its constants even if the first is not used anymore.
That seems to be what happens with other folded constants:
py> def f():
... return 99.0 + 0.9
...
py> f.__code__.co_consts
(None, 99.0, 0.9, 99.9)
so I guess that this is okay for a first draft. One difference is that
strings tend to be much larger than floats, so this will waste more
memory. We ought to consider removing unused constants at some point.
(But not me, sorry, I don't have enough C.)
> Removing it requires looping over the code once more while marking
> the constants seen in a set and I was not sure if this was ok.
That should probably be a new issue. |
|
Date |
User |
Action |
Args |
2019-05-20 15:26:36 | steven.daprano | set | recipients:
+ steven.daprano, rhettinger, gregory.p.smith, serhiy.storchaka, mbussonn, pablogsal, remi.lapeyre |
2019-05-20 15:26:36 | steven.daprano | link | issue36906 messages |
2019-05-20 15:26:36 | steven.daprano | create | |
|