Inheritance and name clashes

Steve Howell showell30 at yahoo.com
Sun Oct 3 18:41:50 EDT 2010


On Oct 3, 3:04 pm, Rock <rocco.ro... at gmail.com> wrote:
> > Object-oriented designs are difficult to design in any programming
> > language, and it helps to have some sort of concrete problem to drive
> > the discussion.  Are you working on a particular design where you
> > think Python's philosophy will inhibit good design?  My take on Python
> > is that it focuses more on enabling good designs than preventing bad
> > designs.  I prefer this to Java, for example, which I feel inhibits me
> > from expressiveness at a higher cost than any supposed benefits
> > private/protected would give me.
>
> Thanks for the reply. No, I was just working with a normal library
> class which was supposed to be derived. So that's what I did, but in
> the process I found myself needing to create an instance variable and
> it dawned on me: "how do I know I'm not clobbering something
> here???" ... I'd have to look at the docs, right? But I still wasn't
> sure ... so, then I thought "let's look at the source", and then I
> found out. But! It took me some time to make sure, and I was puzzled
> as well. I mean, what if I have no source to look at? What if the
> library I'm using doesn't realase the source, or what if I just can't
> get my hands on it for some reason or another?
>
> That was a big disappointment with Python for sure. Somehow PHP makes
> me feel a little safer, in that respect at least.

One workaround is to save all your state under a single object like a
dictionary.  Or maybe you can avoid saving state altogether.



More information about the Python-list mailing list