Python from Wise Guy's Viewpoint

Pascal Costanza costanza at
Fri Oct 24 22:51:30 CEST 2003

Marshall Spight wrote:

>>In a decent dynamically typed language, you have proper name space
>>management, so that a method cannot ever be defined for a class only by
> How can a method be defined "by accident?" I can't figure out what
> you're trying to say.

class C {
   void m();

class D {
   void m();


void doSomething (Object o) {
   if (o instanceof C) {

"Oops, by accident method m is also defined in D, although I wanted to 
call method m in C."

Doesn't happen in languages with proper name space management. (The 
problem is that Java gives you only the illusion of well-behaved 


P.S, before anyone repeats the same issue again: Yes, Java has a badly 
designed static type system. The example was not a very good one in the 
first place. Doesn't matter wrt to my essential message though.

Pascal Costanza               University of Bonn
mailto:costanza at        Institute of Computer Science III  Römerstr. 164, D-53117 Bonn (Germany)

More information about the Python-list mailing list