[Types-sig] Re: Type equivalence

Barry A. Warsaw barry@digicool.com
Thu, 15 Mar 2001 09:20:03 -0500


>>>>> "PP" == Paul Prescod <paulp@ActiveState.com> writes:

    PP> It would be easy enough to add it but it depends on whether we
    PP> want the definition of

    PP> 	lambda obj: obj in (0, 1)

    PP> or the definition that "every object can be used as a
    PP> boolean":

    PP> 	lambda obj: "you betcha!"

The type/class that I've prototyped (in either a C or Python module)
defined two objects `true' and `false' which mostly supported
comparison semantics with current true and false objects in Python.
E.g. true == 1, but true is not 1, and false == {} but false is not {}.

I say mostly because it's not completely possible to do the right
thing qpre-richcomps.  I could do some digging and update the code.

    PP> In some future "strict types" mode, this sort of "passing off"
    PP> might issue a warning. I claim, though, that it won't arise
    PP> that much in practice.

Maybe, but I really don't know.  Python's typing system will
undoubtably have its own unique quirks, and "normal usage patterns"
cannot be fully predicted.  That's why we need to get some experience
with a working implementation.

-Barry