Tom Anderson <[EMAIL PROTECTED]> wrote:
> Is there any reason you have to stringify the type signature? Types
> are hashable, so a tuple of types is hashable, so you can just use
> that as a key. Replace "methods[f.func_name][str(types)] = f" with
> "methods[f.func_name][types] = f" and "type_str = str(tuple([type(arg)
> for arg in args]))" with "type_str = tuple(type(arg) for arg in
> args)". And then rename type_str to types thoughout.

You're right. I initially had a list in there and it wasn't hashable
(and I thought tuples aren't either). Anyway, the implementation is
just an example, it should use isinstance() instead. The link posted
by Kay shows a better implementation.

-- 
Catalin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to