Nick,

On 2012-06-07, at 2:56 AM, Nick Coghlan wrote:
> On Thu, Jun 7, 2012 at 11:16 AM, Yury Selivanov <yselivanov...@gmail.com> 
> wrote:
>> On 2012-06-06, at 9:00 PM, Nick Coghlan wrote:
>> So, the idea for the 'signature(obj)' function is to first check if
>> 'obj' has '__signature__' attribute set, if yes - return it, if no -
>> create a new one (but don't cache).
> 
> I'd say return a copy in the first case to be safe against accidental
> modification. If someone actually wants in-place modification, they
> can access __signature__ directly.

OK.  And I'll implement __copy__ and __deepcopy__ for Signatures.

> Bonus: without implicit signature copying in functools, you can stick
> with the plan of exposing everything via the inspect module.

Exactly!

> We should still look into making whatever tweaks are needed to let
> inspect.signature correctly handle functools.partial objects, though.

Seems doable.  'partial' exposes 'func', 'args' and 'keywords' attributes,
so we have all the information we need.

Thank you,
-
Yury

_______________________________________________
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

Reply via email to