[Python-Dev] PEP 267 -- is the semantics change OK?
Jeremy Hylton
jeremy at alum.mit.edu
Sat Oct 22 00:48:34 CEST 2005
On 10/21/05, Jim Jewett <jimjjewett at gmail.com> wrote:
> (In http://mail.python.org/pipermail/python-dev/2005-October/057501.html)
> Neil Schemenauer suggested PEP 267 as an example of something that
> might be easier with the AST compiler.
>
> As written, PEP 267 does propose a slight semantics change -- but it
> might be an improvement, if it is acceptable.
No, it does not. PEP 267 suggests a way to preserve the existing
semantics. You could probably come up with a much simpler approach if
you agreed to change semantics.
Jeremy
> Today, after
>
> from othermod import val1
> import othermod
> val2 = othermod.val2
> othermod.val3 # Just making sure it was referenced early
>
> othermod.val1 = "new1"
> othermod.val2 = "new2"
> othermod.val3 = "new3"
>
> print val1, val2, othermod.val3
>
> The print statement will see the updated val3, but will still have
> the original values for val1 and val2.
>
> Under PEP267, all three variables would be compiled to a slot
> access in othermod, and would see the updated objects.
>
> In many cases, this would be a *good* thing. It might allow
> reload to be rewritten to do what people expect. On the other
> hand, it would be a change. Would it be an acceptable change?
>
> -jJ
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/jeremy%40alum.mit.edu
>
More information about the Python-Dev
mailing list