Which way to say 'private'?

Jeremy Bowers jerf at jerf.org
Thu Aug 21 22:20:05 EDT 2003


On Thu, 21 Aug 2003 09:45:09 -0700, Daniel Klein wrote:
> I should probably have mentioned that I am concerned about advertising the
> 'public' interface (so that users of the class know how best to use it and
> what my intentions were) more than 'restricting' access to 'private'
> members, which we all know is pretty much pointless in Python ;-)

I personally recommend "If it's not documented, it doesn't exist". Of
course this requires rather better documentation procedures then most
people use typically.

The idea here is that the docstrings document what should be done with the
class, and Python comments (# stuff) documents stuff private to the class.
(Especially critical warnings about things that should *not* be done can
go into the docstrings as well.)

(Actually, IMHO, "if it's not documented it doesn't exist" is *already* a
truth and this technique simply harnesses that, but again, this opinion is
not as popular as it should be.)




More information about the Python-list mailing list