Will python never intend to support private, protected and public?

en.karpachov at ospaz.ru en.karpachov at ospaz.ru
Thu Sep 29 10:29:36 EDT 2005


On Fri, 30 Sep 2005 00:16:02 +1000
Steven D'Aprano wrote:

> Say you have written a class, with a private variable. I decide that I
> need access to that variable, for reasons you never foresaw.

What if the access to that variable was forbidden for reasons you never
foresaw? What if the class author decide to remove the variable in the next
version of the class, because it's not an interface, but only a part of the
class implementation?

> What happens
> next? I ask you nicely to please change your class and turn that private
> attribute into a public one. What happens if you refuse? Can I have you
> taken out and shot and seize ownership of your class, or do I have to
> copy and paste your class into my code, creating a duplicate class I can
> modify as much as I like?

Yes, that's how it works in the open source. What's wrong with it? You
don't need _this_ class, because it's functionality doesn't fit to you. So
you take the source code and write another class, doing exactly what you
want it to do.

-- 
jk



More information about the Python-list mailing list