[Python-Dev] Updated PEP 362 (Function Signature Object) (original) (raw)

Yury Selivanov yselivanov.ml at gmail.com
Thu Jun 7 15:37:54 CEST 2012


Nick,

On 2012-06-07, at 2:56 AM, Nick Coghlan wrote:

On Thu, Jun 7, 2012 at 11:16 AM, Yury Selivanov <yselivanov.ml at 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



More information about the Python-Dev mailing list