Python design philosophy

Justin Sheehy dworkin at ccs.neu.edu
Wed Jun 28 18:44:08 EDT 2000


Steve Juranich <sjuranic at condor.ee.washington.edu> writes:

> I was wondering why there really isn't such an idea as a "private"
> member of classes?

Because there isn't a good reason to have them in Python.

There are plenty of good reasons to have them in other languages, but
that isn't what the question was about.

> I understand that members can be hidden, but not really protected
> from the user.  I was wondering what the benefit of this would be?
> Wouldn't it open the possibility of security holes?

Non sequitur.  No matter what one's opinion is on private class
members, this has nothing to do with security.

> Also, what benefit is gained by allowing a user to add/delete
> members from existing classes?  Wouldn't it be more desirable to
> create his/her own derived class?

In situations where I want to extend an already-created class, I will
usually inherit from it, as that is often the cleanest (and most
desirable, as you put it) thing to do.

However, allowing modifications on the fly to existing classes is a
major feature of Python, and part of what makes it so usefully
dynamic.  Taking away the ability to do that would not make sense.

I note that you didn't actually include any reasons why you think this
behavior should change.  Are there any such reasons, or was this just
a troll?

-Justin

 






More information about the Python-list mailing list