Why does python not have a mechanism for data hiding?
zephyrfalcon!NO_SPAM! at gmail.com
Thu Jun 5 00:42:31 CEST 2008
> On May 24, 9:14 pm, Fuzzyman <fuzzy... at gmail.com> wrote:
>> For example, at Resolver Systems we expose the spreadsheet object
>> model to our users. It hasa public, documented, API - plus a host of
>> undocumented internally used methods.
>> We would really *much* rather hide these, because anything our
>> customers start using (whether documented or not) we will probably
>> have to continue supporting and maintaining.
> Then don't document it, or separate internal documentation (which is
> never to pass through the wall) and public documentation (which your
> users use). Nobody would (apart from your dev team and anyone told by
> your dev team, which means you may fire the person for "lack of
> discipline") know that there is such a thing and in consequence
> wouldn't use it.
> Don't tell your user not to use something, just don't tell them that
> it exists and they won't use it.
I am not familiar with the actual software, but judging from "we expose the
spreadsheet object model to our users", I assume that users can discover the
undocumented attributes, using Python's introspection features, like dir(obj),
obj.__dict__, the inspect module, etc. So in this case, not telling them that
the attributes exist, will not stop them from finding out.
Hans Nowak (zephyrfalcon at gmail dot com)
More information about the Python-list