On 10/30/2021 10:40 AM, Chris Angelico wrote:
And, seeing something in help(fn) largely necessitates that the source
code be retained. I don't know of any other way to do it. If you say
that the default argument is "len(a)", then that's what help() should
say.

"from __future__ import annotations" works by decompiling the AST into a string. From PEP 563: "The string form is obtained from the AST during the compilation step, which means that the string form might not preserve the exact formatting of the source."

I'm not saying this is a better way to do it, but it is another way. And it might save some memory. I don't think the slight differences mentioned at the end of that sentence would make a difference in practice.

Eric

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/3YLTC4EB3DJKANQMZCDD5HFTVICYXFZM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to