Smalltalk and Python

Greg Ewing greg at cosc.canterbury.ac.nz
Fri Dec 15 02:44:24 CET 2000


Alex Martelli wrote:
> 
> I am not aware of any OOA approaches in which ... let 
> some objects be an instance of ... several classes
> at the same time.

Just to throw another language into the mix,
the TADS (Text Adventure Development System)
lets you declare objects with multiple
classes, e.g.

   bed: Furniture, Surface, Scenery
      ...

declares a singleton object called 'bed'
which belongs to the classes Furniture,
Surface and Scenery.

This is really just syntactic sugar, since
you could just as well declare a new class
inheriting from all those and then instantiate
it. But it's extremely handy in a language
designed for applications where the vast
majority of objects tend to be singletons.

To mention something vaguely Python-relevant:
if Python had a convenient syntax for declaring 
singletons, it could be a pretty good language for
Interactive Fiction...

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list