[Python-Dev] Keyword module cruft question
Patrick K. O'Brien
pobrien@orbtech.com
Tue, 29 Oct 2002 17:27:19 -0600
On Tuesday 29 October 2002 05:02 pm, Martin v. Loewis wrote:
> "Patrick K. O'Brien" <pobrien@orbtech.com> writes:
> > But it does look sloppy when you are writing about introspection and
> > you see an attribute that has no real value. I wish it weren't
> > there, as I'd rather not have to explain it. But it got me thinking
> > whether other modules in the standard library have this issue, and
> > whether this is something that should be cleaned up. Thoughts?
>
> Normally, this is fixed with __all__: The module may have arbitrary
> variables; the interface is only those identifiers mentioned in
> __all__ (in absence of __all__, its only those identifiers which are
> documented).
Well, in this case, keyword's __all__ looks like:
__all__ =3D ["iskeyword"]
Which leaves out keyword.kwlist, a pretty useful attribute.
> So I don't think this is an issue, in general. In a specific case,
> there is nothing wrong with fixing it.
I'd also suggest that __all__ as a determiner of a module's api is severe=
ly=20
underdocumented.
Maybe I just picked the wrong module to start off my article. ;-)
--=20
Patrick K. O'Brien
Orbtech http://www.orbtech.com/web/pobrien
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------