Why does python class have not private methods? Will this never changed?

Adriano Ferreira a.r.ferreira at gmail.com
Tue Apr 19 15:07:44 EDT 2005


>but why does it hava not private methods?
Because it does not need them, ain't it?

>Private stuff always makes programming much easier.
Does it? Sometimes contortion is needed to get rid of declarations
that restrain access, for example, when writing tests.

I think the point-of-view of Python is very akin to many others in
communities related to dynamic languages. Privacy is most convention.
If sometimes you decide to look under the hood, you are not forbidden
to, but you are on your own.

Two quotes that make sense in this issue:

(from "perlmodlib"): It [the programming language] would prefer that
you stayed out of its living room because you weren't invited, not
because it has a shotgun.

(from Roberto Ierusalimschy, Lua's designer): If you don't want to do
something, just don't.

I think it is a cultural thing. Python has no "real" private methods
and fields, because it did not grow worried about that. And that
doesn't stop programmers from being productive.

Regards,
Adriano.



More information about the Python-list mailing list