From: Matt Gushee Date: 2002-09-06T00:50:09+09:00 Subject: Re: Ruby aesthetics On Fri, Sep 06, 2002 at 12:33:23AM +0900, Gavin Sinclair wrote: > > > (Sure, there is a way around this in > > Python, but it has to be manually made by the programmer, not built-in in > > the language itself.) > > AFAIK, you can't make data private in Python. No, you can't. You can prevent a module or class from *exporting* a name by prefixing it with a single underscore ... but anyone who knows that name exists can still use it in qualified form. You can take this one step further by prepending __ (double underscore) to an instance method name, and the byte-compiler will generate an obfuscated name, providing pseudo-privacy ... but it does so in a predictable fashion, so it is still possible to access the method if you really want to. These were deliberate design choices. The philosophy behind it is that an API should be a guide for developers, not a straitjacket. -- Matt Gushee Englewood, Colorado, USA mgushee@havenrock.com http://www.havenrock.com/