Message401024
> I am still not convinced that it's a good idea to put the docstring in the surrounding code object. I'd like to be able to see it when I introspect a code object, not just when introspecting a function object (I may be analyzing code only, and it's hard to connect the code object with the NEW_FUNCTION opcode in the parent code object -- you have to scan the bytecode, which is fragile.)
I think that reasoning is not strong enough to add new member to code object.
* Modules and classes don't get docstring from their code objects. Why only functions need to store docstring?
* Lambdas, comprehensions, and PEP 649 (if acceptted) uses code objects but no docstring. Why they need to pay cost of `co_doc` member? (cost = memory + unmarshal time).
Code objects have filename and firstlineno. And there are many functions without docstring. So removing docstring from code object won't make inspection hard so much. |
|
Date |
User |
Action |
Args |
2021-09-04 00:52:02 | methane | set | recipients:
+ methane, gvanrossum, rhettinger, terry.reedy, serhiy.storchaka, Guido.van.Rossum, iritkatriel |
2021-09-04 00:52:02 | methane | set | messageid: <1630716722.13.0.707445591704.issue36521@roundup.psfhosted.org> |
2021-09-04 00:52:02 | methane | link | issue36521 messages |
2021-09-04 00:52:01 | methane | create | |
|