[Types-sig] Re: Types-SIG digest, Vol 1 #13 - 2 msgs

JOrendorff@ixl.com JOrendorff@ixl.com
Mon, 30 Nov 1998 11:18:21 -0800


D. Binks wrote:
> There are lots of parts of Python that pose problems for type
> systems.
 [...]
> Then x can legitimately take either an Int or a String, which is
> possibly quite hard to code in a type system.

I think a more compelling example is the variable that can be
"either instance of 'foo.Blah' or None".  re.match(), for example,
returns a value of this type.

With no fix, 'x' could just be an "anything", and the hypothetical type
system would ignore it.

Fix 1.  Python could get some sort of mechanism for overloading
functions based on argument types, like C++ and Java.  (Not sure if
this is a good idea or a horrific one.)

Fix 2.  The type system tries to cover this by allowing you to
declare a value of "either type x or type y".  Ugh.

Fix 3.  The particular case "either type x or None" gets special
treatment from the type system.  0.5 ugh.

I think "no fix" is the right option for now; the proper fix can be
applied in 2.1 or later.

-- 
Jason