[issue8887] “pydoc str” works but not “pydoc str.translate”

Éric Araujo report at bugs.python.org
Fri May 27 18:23:01 CEST 2011


Éric Araujo <merwok at netwok.org> added the comment:

> Since *parts* is a list, the above can be replaced with simply "if parts:"

Heh, I always use implied truth values and one disagreed with Tarek about this, but here if felt more natural to spell out my mind with an explicit > 0 comparison :)

> Also, it seems to me that the new code may produce an AttributeError
> when given invalid name

I didn’t see that, I forgot to test invalid names, since test_pydoc already has some checks.  I’ll add tests and see if I can reproduce what you’re hinting at (it would be helpful if you could give examples of invalid names: full dotted names, method names, class names?).

> I wouder if it would be possible to reuse the try/except logic ing
> the "if module" clause

Sure, as long as the tests pass I have no preference about the implementation.  BTW, what’s your opinion on the test I added?  I use render_doc to test name resolving, do you think I should also test the command-line pydoc in a subprocess or is it okay to have white-box knowledge here?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8887>
_______________________________________


More information about the Python-bugs-list mailing list