Why does python not have a mechanism for data hiding?
Terry Reedy
tjreedy at udel.edu
Tue May 27 02:04:48 EDT 2008
"Russ P." <Russ.Paielli at gmail.com> wrote in message
news:03655ec7-2136-4cea-9575-34e321356439 at p25g2000pri.googlegroups.com...
| Hmmm... that seems a bit strange. Why should "_variable" be visible
| when you use "import module"
Because you only add one name to the current namespace -- bound to a
module -- and there is no reason to exclude attributes of that object.
|but not when you use "from module import *"?
Because you are already adding m names and adding n more names may cause
problems -- which is what lead to the addition of the __all__ mechanism
some years back. Sorry, I forget the details because they don't concern
me.
| > That last form should not be used normally, except when playing with
the
| > interactive interpreter.
|
| OK, I have a confession to make. I use "from module import *" almost
| exclusively. But then, I'm different from most folks. I can drink six
| beers and still drive safely, for example. The key is to drive faster
| so I can get past dangerous situations quicker.
More information about the Python-list
mailing list