[Python-Dev] PEP 362: 4th edition

Nick Coghlan ncoghlan at gmail.com
Tue Jun 19 04:06:40 CEST 2012


On Tue, Jun 19, 2012 at 12:00 PM, Yury Selivanov
<yselivanov.ml at gmail.com> wrote:
> On 2012-06-18, at 9:36 PM, Nick Coghlan wrote:
>> So keep the current copying semantics for Signature objects (i.e.
>> creating new copies of the Parameter objects as well), but call it a
>> shallow copy rather than a deep copy. Make it clear in the
>> documentation that any defaults and annotations are still shared with
>> the underlying callable.
>
> So, 'Signature.__deepcopy__()' -> 'Signature.shallow_copy()'?  Or make
> it private - 'Signature._shallow_copy()'?

I'd just call it Signature.__copy__ :)

You're not doing anything unusual here, just declaring that the list
of parameters is a part of the Signature object's state, and thus even
a shallow copy shouldn't share the parameter objects.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list