encapsulation?

Peter Hansen peter at engcorp.com
Tue Aug 14 05:54:48 CEST 2001


Ken Seehof wrote:
> 
> From: "Stefan Schwarzer" <s.schwarzer at ndh.net>
> >
> > Lloyd Goldwasser schrieb:
> > > As a recent convert to Python (I have C, Objective-C, and Scheme, among
> > > others, in my past), I'm curious about its lack of encapsulation. 
> >
> > There was a nice posting/thread on this some time ago:
> >
> http://groups.google.com/groups?q=ken+seehof+encapsulation&hl=en&group=comp.
> lang.python.*&safe=off&rnum=1&selm=39491494.671DC3D9%40sightreader.com
> >
> Actually it is only a technicality that python lacks encapsulation anyway.

It may be merely a matter of terminology, not even a technicality.
To me (and http://www.dictionary.com/cgi-bin/dict.pl?term=encapsulation )
encapsulation in object-oriented programming is merely about packaging 
stuff together, not hiding it.  By that definition, Python obviously *has* 
encapsulation.

> The "__" syntax allows you to hide members.  But since you can get around
> it, people say python doesn't have encapsulation.  

And those people are wrong, of course.  Irrelevant, but wrong.  ;-)

-data-hiding-is-another-story-ly yr's
-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list