Message402892
Not so fast.
I'm not in favor of (c) co_doc either any more (for the reasons you state). I would go for (b), a CO_DOCSTRING flag plus co_consts[0]. I expect that co_consts sharing to be a very minor benefit, but you could easily count this with another small change to the count script.
Moving the docstring to the surrounding object would not make much of a difference time- or speed-wise but I think it's the wrong thing to do since it dissociates the docstring from the function.
Nested function creation could perhaps become a fraction faster if we didn't copy the docstring into the function object, leaving it func_doc NULL, making func.__doc__ a property that falls back on co_consts[0] if the flag is set.
I expect lazy docstrings to be in the distant future (I experimented quite a bit with different marshal formats to support this and it wasn't easy at all) but I don't want to exclude it. |
|
Date |
User |
Action |
Args |
2021-09-29 17:22:53 | gvanrossum | set | recipients:
+ gvanrossum, rhettinger, terry.reedy, methane, Mark.Shannon, serhiy.storchaka, Guido.van.Rossum, iritkatriel |
2021-09-29 17:22:52 | gvanrossum | set | messageid: <1632936172.11.0.24973132939.issue36521@roundup.psfhosted.org> |
2021-09-29 17:22:52 | gvanrossum | link | issue36521 messages |
2021-09-29 17:22:51 | gvanrossum | create | |
|