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

Steven D'Aprano steve at pearwood.info
Thu Jun 7 00:38:33 CEST 2012


Brett Cannon wrote:
> On Wed, Jun 6, 2012 at 12:16 PM, Steven D'Aprano <steve at pearwood.info>wrote:
> 
>> Larry Hastings wrote:
>>
>>  [...]
>>>> "Changes to the Signature object, or to any of its data members,
>>>> do not affect the function itself."
>>>>
>>>> which leaves the possibility that __signature__ may no longer match the
>>>> actual argument spec, for some reason. If you remove getfullargspec, people
>>>> will have to reinvent it to deal with such cases.
>>>>
>>> There's no reason why they should disagree.  The "some reason" would be
>>> if some doorknob decided to change it--the objects are mutable, because
>>> there's no good reason to make them immutable.
>>>
>> Nevertheless, the world is full of doorknobs, and people will have to deal
>> with their code.
>>
> 
> This is also Python, the language that assumes everyone is an consenting
> adult.

Exactly, which is why I'm not asking for __signature__ to be immutable. Who 
knows, despite Larry's skepticism (and mine!), perhaps there is a use-case for 
__signature__ being modified that we haven't thought of yet.

But that's not really the point. It may be that nobody will be stupid enough 
to mangle __signature__, and inspect.getfullargspec becomes redundant. Even 
so, getfullargspec is not doing any harm. We're not *adding* complexity, it's 
already there, and breaking currently working code by deprecating and then 
removing it is not a step we should take lightly. API churn is itself a cost.



[...]
> If people really want to keep getullargspec() around then I want to at
> least add a note to the function that signature objects exist as an
> alternative (but not vice-versa).

+1



-- 
Steven



More information about the Python-Dev mailing list