[Python-3000] Type Comparisons with Godel Numbers

Bill Birch birchb at tpg.com.au
Sat Apr 22 14:03:53 CEST 2006


On Sat, 22 Apr 2006 03:12 am, Jim Jewett wrote:
> On 4/20/06, Birch, Bill <birchb at anz.com> wrote:
> > Type comparison operators would only need a deep
> > inspection of the types when the godel strings don't match.
> > If most comparisons will be an exact match (not a subtype)
> > the lookup should be faster.
>
> If you're assuming that, then just checking whether
>
>     obj.__class__ is requirement.allowed_class
>
> should be pretty hard to beat...
OK that will work for atomic types.

But if obj.__class__ is <type 'list'> it does not tell us what is _in_ the 
list. We want to know it's list[any] or list[int] ot list[str] etc. 


More information about the Python-3000 mailing list