Why does python not have a mechanism for data hiding?

cokofreedom at gmail.com cokofreedom at gmail.com
Wed Jun 11 09:44:21 CEST 2008


On Jun 11, 8:11 am, "Russ P." <Russ.Paie... at gmail.com> wrote:
> On Jun 10, 11:58 am, Jonathan Gardner
>
> > Who cares what the type of an object is? Only the machine. Being able
> > to tell, in advance, what the type of a variable is is a premature
> > optimization. Tools like psyco prove that computers (really,
> > programmers) nowadays are smart enough to figure things out the right
> > way without any hints from the developer. Static typing is no longer
> > necessary in today's world.
>
> You couldn't be more wrong. Even Guido recognizes the potential value
> of static typing, which is why he is easing it into Python as on
> optional feature. He recognizes, correctly, that it can detect errors
> earlier and facilitate more efficient execution. But there's another,
> more significant potential benefit for safety-critical and mission-
> critical applications: static typing facilitates advanced static
> analysis of software.

Can you provide me with any example of Guide wanting static typing to
be
optional? I haven't. Any why is it you keep going so abstract in this
discussion.

>
> You may be right to an extent for small or medium-sized non-critical
> projects, but you are certainly not right in general. I read something
> a while back about the flight software for the Boeing 777. I think it
> was something like 3,000,000 lines of Ada code. Normally, for a
> project of that magnitude the final integration would be expected to
> take something like three months. However, the precise interface specs
> and encapsulation methods in Ada allowed the integration to be
> completed in just three days.
>

Well, that isn't just because they used encapsulation, the likelihood
is well thoughtout planning, constant system testing (that DOES
require accessing of those more private methods to ensure there are no
problems throughout), and re-testing. Again since I'm not sure how
much I trust you and your statistics anymore, have you a link to
anything discussing this?

>
> I realize that Python is not designed for such large projects, but
> don't you think certain general principles can be learned anyway?
> Perhaps the benefits of interface specs and encapsulation are not as
> obvious for smaller projects, but certainly they are not zero.

Python is designed to be an efficient high level language for writing
clear readable code at any level. Considering the amount of use it
gets from Google, and the scope and size of many of their projects, I
find it foolish to say it is not designed for large projects. However
I do not myself have an example of a large python project, because I
don't program python at work.

I think the issue here is your want to have python perform exactly
like OO built languages such as Java, but it isn't Java, and that, is
a good thing.



More information about the Python-list mailing list