[Types-sig] Re: The role of PyObjects

Paul Prescod paul@prescod.net
Thu, 16 Dec 1999 10:18:38 -0800

Martijn Faassen wrote:
> I'm afraid that
> even with the operator, you wouldn't be able to check most of the code,
> if PyObjects are freely allowed. Perhaps I'm wrong, but I'd like to see
> some more debate about this.

PyObjects are just another type. In Python or any OO language it is
ABSOLUTELY impossible to know the type of every object at compile time
because of polymophism:

a = CGIHTTPServer()
b = BaseHTTPServer()

startServer( a )
startServer( b )

startServer does not know the exact types at compile time. The basic
nature of the problem does not change if we have a function that expects
just a "PyObject" (the base class of all base classes). Of course if the
function is to be statically type checked then you cannot use operations
on the object other than those allowed by PyObjects, but the basic
principle is the same.

 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Three things never trust in: That's the vendor's final bill
The promises your boss makes, and the customer's good will