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

Jaime Wyant programmer.py at gmail.com
Tue Apr 19 09:42:16 EDT 2005


Have I missed something?  Doesn't this mangle class methods:

class Foo:
  def __bar(self):
    print "bar"

Granted, you could probably figure out how the names are being
mangled.  In the example above __bar is a defacto private method. 
Griping about it not having `private' in front of it is asinine.  If
someone intentionally has to call a `private' method, then the design
is at fault, not the language.

jw

On 4/19/05, Peter Hansen <peter at engcorp.com> wrote:
> Roy Smith wrote:
> >  Simon Brunning <simon.brunning at gmail.com> wrote:
> >>On 4/19/05, could ildg <could.net at gmail.com> wrote:
> >>>Private stuff always makes programming much easier.
> >>
> >>That contention is, at best, debatable. See
> >>http://groups-beta.google.com/group/comp.lang.python/msg/b977ed1312e10b21.
> >
> > Nice essay.  Now, for another look at the same issue...
> > http://thedailywtf.com/forums/32534/ShowPost.aspx
> 
> Where in the original posting or in the 86 replies
> in that massive page are we supposed to find something
> pointed about this issue?
> 
> Also, do any of the people there use a language like
> Python, or are you merely pointing to one example in
> another language (Java) where, perhaps, "private"
> should have been used?
> 
> Or does this actually back up Simon's point?  You
> don't say and it's really unclear what your point is.
> 
> -Peter
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list