Erik Bray added the comment:

For what it's worth (since it was mentioned toward the end of this thread as an 
offending package) Astropy has a patch now to fix its misbehavior with respect 
to this issue.

I do feel like this would be nice to fix though, since I think it's awkward to 
have code that on its face clearly has a docstring, but still have to check 
that the docstring may be None.  Just to put it out there if anyone were really 
interested, I identified two ways this could be changed:

1) For functions add a new co_flags flag indicating that docstrings were 
optimized out.  This is at the cost of a co_flags flag.

2) Keep an empty string as the first element in co_consts, at the const of one 
additional constant per function that previously had a docstring (still cheaper 
than the docstring itself in most cases).

Of course, it would still break backward compatibility for code that expects 
None for an optimized out docstring, I guess, and probably isn't worth either 
of the above two sacrifices at the end of the day.

----------
nosy: +erik.bray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23189>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to