Why does python not have a mechanism for data hiding?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat May 24 13:18:33 EDT 2008


Ben Finney:
>In Python, the philosophy "we're all consenting adults here" applies.<

Michael Foord:
> They will use whatever they find, whether it is the best way to
> achieve a goal or not. Once they start using it they will expect us to
> maintain it - and us telling them it wasn't intended to be used by
> them in the first place won't cut it.

So they will use the methods with one or two underscores too. And
imply that you want to document them too.
They don't seem adult enough, then ;-)
Internal API hiding seems quite less useful if you don't need to let
customers manage your code.

Bye,
bearophile



More information about the Python-list mailing list