[Types-sig] List of FOO

Paul Prescod paul@prescod.net
Tue, 14 Dec 1999 12:33:56 -0800


Martijn Faassen wrote:
> 
> I agree completely, and one *can* express most of this pretty easily in
> current Python, i.e.:
> 
> types = {
>     "bar": IntType,
>     "baz": ListType(IntType),
>     "hey": IntType,
>     "foo3": FunctionType(args=(IntType,), result=IntType),
> 
>     "crazy" : ListType(FunctionType(args=(ListType(IntType),
> StringType),                                 result=DictType(StringType,
> 
> FunctionType(args=None,
> result=StringType)))
> }

Questions:

1. This system is supposed to be extensible, right? So I could, for
instance, define a binary tree module and have "binary trees of ints"
and "binary trees of strings." How do I define the binary tree class and
state that it is parameterizable?

2. How does this work with interfaces? "ListType" is cheating. We need
SequenceType because that's not implementation specific. And
SequenceType needs to be defined by an interface, not a class.

3. What does "tuple of int, string" look like? And should we have list
length parameters?

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Three things to be wary of: A new kid in his prime
A man who knows the answers, and code that runs first time
http://www.geezjan.org/humor/computers/threes.html