[Python-Dev] PEP 362: 4th edition

PJ Eby pje at telecommunity.com
Mon Jun 18 19:35:44 CEST 2012


On Fri, Jun 15, 2012 at 5:03 PM, R. David Murray <rdmurray at bitdance.com>wrote:

> On Fri, 15 Jun 2012 22:48:42 +0200, Victor Stinner <
> victor.stinner at gmail.com> wrote:
> > > 1. Should we keep 'Parameter.implemented' or not.  *Please vote*
>
> -1 to implemented.
>
> > I still disagree with the deepcopy. I read somewhere that Python
> > developers are consenting adult. If someone really want to modify a
> > Signature, it would be nice to provide a simple method to copy it. But
> > I don't see why it should be copied *by default*. I expect that
> > modifying a signature is more rare than just reading a signature.
>
> The issue isn't "consenting adults", the issue is consistency.
> Without the deepcopy, sometimes what you get back from the
> inspect function is freely modifiable and sometimes it is not.
> That inconsistency is a bad thing.
>

Then just copy the signature itself; as currently written, this is going to
copy the annotation objects, which could produce weird side-effects from
introspection.  Using deepcopy seems like overkill when all that's needed
is a new Signature instance with a fresh OrderedDict.

Or, better yet: make signature and parameter objects immutable (along with
the OrderedDict) and the whole problem of modification and copying goes
away altogether.  Or is there some reason not mentioned in the PEP why
mutability is necessary?  (The PEP provides no rationale at present for
making any part of a signature mutable)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120618/493f01f4/attachment.html>


More information about the Python-Dev mailing list