Private methods
D.M. Procida
real-not-anti-spam-address at apple-juice.co.uk
Tue Oct 9 09:59:27 EDT 2012
Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> On 09/10/2012 14:24, D.M. Procida wrote:
> > What exactly is the point of a private method? Why or when would I want
> > to use one?
> >
> > Daniele
> >
>
> Hardly a Python question but using a search engine could have got you
> here, and rather faster :)
>
http://stackoverflow.com/questions/2620699/why-private-methods-in-the-ob
ject-oriented
Thanks. Sometimes I prefer to talk to real people on Usenet than do web
searches. Just my preference.
Anyway, one of the answers on that page explains that public methods are
interfaces to a class, that other things might rely on, and private ones
are for its own internal logic, that other things don't need to care
about.
In Python, using an underscore is simply a convention to note that a
method is private - it doesn't actually hide it from other things -
correct?
Daniele
More information about the Python-list
mailing list