(original) (raw)
On Fri, Jun 15, 2012 at 5:03 PM, R. David Murray <rdmurray@bitdance.com> wrote:
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)
On Fri, 15 Jun 2012 22:48:42 +0200, Victor Stinner <victor.stinner@gmail.com> wrote:-1 to implemented.
> > 1\. Should we keep 'Parameter.implemented' or not. �\*Please vote\*
The issue isn't "consenting adults", the issue is consistency.
> 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.
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)