On Nov 7, 3:05 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > John Machin <[EMAIL PROTECTED]> writes: > > > You could use a second dict for the other type: > > > > def lookup(x): > > > if x in dict1: return dict1[x] > > > return dict2[x] > > > > dict1 would have the 4 special keys and dict2 would have the regular > > > keys. > > > Ummm how do you get "the 4 special keys" in dict1? > > oops, adjoin the type > > def lookup(x): > if (x,type(x)) in dict1: return dict1[x]
Possibly you meant: key = (x, type(x)) if key in dict1: return dict1[key] > return dict2(x) > > so dict1 would contain tuples as keys, but just a few of them. -- http://mail.python.org/mailman/listinfo/python-list