Python Scalability

Evan Simpson evan at tokenexchange.com
Wed May 26 13:16:00 EDT 1999


Frankly, until we have Swallow, or SPython, or Dylthon, or some other quite
restrictive subset of Python, reliable compile-time checking of interface
contracts is right out, and even then the price might be more than you want
to pay.

Here's an approach which might get you 90% of what you want, though:  Write
an interface-compliance framework, and use it with Tim Peters' excellent
doctest module.  That way, you could actually write something like:

class PetShop(Sketch, Humorous):
    '''>>> from strictinterface import verify
       >>> verify(PetShop, PetShop.__bases__)
       1
       >>> PetShop(pet='parrot', customer='Cleese').status()
       'deceased'
    '''
    # etc

This doesn't get you compile-time, but at least you would have a discrete
and well-defined testing process, and it would help document your
requirements.  Plus, you'd have full control over what your requirements
really are.

explicit-beats-implicit-and-two-pair-ly y'rs
Evan Simpson

dacut at kanga.org wrote in message <7ieh57$18b$1 at nnrp1.deja.com>...
Unfortunately, there's no easy way to tell (at bytecompile time) whether
a child has actually implemented an abstract method.  You still have to
wait for the exception to trickle down at run-time.  The only difference
is that it's something other than an AttributeError exception.







More information about the Python-list mailing list