[Python-Dev] PEP 572: Assignment Expressions
Nick Coghlan
ncoghlan at gmail.com
Tue Apr 24 23:40:49 EDT 2018
On 25 April 2018 at 06:23, Mike Miller <python-dev at mgmiller.net> wrote:
> Now, I agree that's not a difference of much consequence, but the difference
> from "import as" is not either.
Since this example has been brought up by a few folks now, I'll note
that "import x.y.z as c" has never been entirely equivalent to a
simple assignment, since it *also* avoids the default binding of "x"
in the current namespace.
These days, it's diverged even further, since we added a fallback to
looking for the full "x.y.z" key in sys.modules if any part of the
submodule lookup chain gets an AttributeError.
The proposed name binding expressions aren't like that - they really
are just an ordinary binding of the result of the given expression to
the given name.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list