PEP 285: Adding a bool type

Mark McEahern marklists at mceahern.com
Wed Apr 3 12:03:53 EST 2002


[Laura Creighton]
> That is more strongly worded then I would make it; I only think that
> deciding that a function should be compelled to return only one of
> two values requires long and careful deliberation.  This is because it
> is likely that some day you will wish that you could provide more
> information than this allows.  isinstance is a good example
> of this. I would be pleased if isinstance returned more useful info
> than just yes/no, such as : 0, no inheritance; 1: direct instance of the
> requested class; 2: instance of a subclass of the requested class.
> 90% of uses would still be yes/no, but this would be fine, and you would
> get the extra information when you needed it.

That's an eye-opening and thoughtful response.  All I'm saying is that this
design philosophy is completely orthogonal to the value of PEP 285.

Further, if I wanted such a function, I wouldn't call it isinstance().

Cheers,

// mark






More information about the Python-list mailing list