Why does python not have a mechanism for data hiding?

Terry Reedy tjreedy at udel.edu
Sat May 24 21:28:26 EDT 2008


"Benjamin Kaplan" <benjamin.kaplan at case.edu> wrote in message 
news:ec96e1390805241357i6e481e3enf12b4d213e887008 at mail.gmail.com...
| On Sat, May 24, 2008 at 10:14 AM, Fuzzyman <fuzzyman 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.
| >
| > The 'we told you not to use that' approach, when applied to paying
| > customers doesn't really work... all they see is that you broke their
| > spreadsheet code by changing your API.

Python was not really written with 'difficult' customers in mind ;-)

One could largely hide private vars with a program that substituted random 
names for single _ names, and removed the doc strings for functions, 
classes, and methods with such names.

Such a program could even put such names in a separate module imported as 
'_private_do_not_use_'. 






More information about the Python-list mailing list