On Wed, Jun 20, 2012 at 1:28 PM, Yury Selivanov <yselivanov...@gmail.com> wrote: > On 2012-06-19, at 11:24 PM, Nick Coghlan wrote: >> The constructor accepts an iterable of Parameter objects rather than a >> mapping. > > That's the code I've ended up with: > > sig = signature(obj.__func__) > return Signature(OrderedDict(tuple(sig.parameters.items())[1:]), > **sig.optional)
Why require a mapping as the argument? A simple iterable of Parameter objects seems like a more convenient constructor API to me. The constructor can take care of building the mapping from that internally via: param_map = OrderedDict((param.name, param for param in parameters)) > Still looks better than creating implicit & explicit copies ;) Indeed :) > > As for slices support in OrderedDict -- it would return values, so > it won't solve the problem anyways. You wouldn't want to do it anyway - while slices happen to not be hashable *now*, there's no strong reason behind that. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com