help on "from deen import *" vs. "import deen"
Chris Angelico
rosuav at gmail.com
Sat Nov 19 01:58:21 EST 2016
On Sat, Nov 19, 2016 at 3:34 PM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
> What happens if you do this?
>
> spam = eggs = cheese = obj
>
> Is that different from:
>
> spam = obj
> eggs = obj
> cheese = obj
>
>
> or from this?
>
> spam = obj
> eggs = spam
> cheese = eggs
> ...
> These aren't silly questions.
Indeed, they are not silly. It surprised me (as a C programmer) that
the assignments happen left-to-right, rather than right-to-left (in C,
cheese would be set first, then eggs, then spam). These are questions
filled with subtleties.
ChrisA
More information about the Python-list
mailing list