The CPython 3.1.1 language reference ยง4.1 says

  "Each command typed interactively is a block."

It also says

  "If a name is bound in a block, it is a local variable of that block, unless
   declared as nonlocal"

Even with a non-literal try-for-best-meaning reading I can't get this to mesh with the actual behavior of the interpreter, e.g.

  >>> for x in "poi":
  ...    fandango = 666
  ...
  >>> fandango
  666
  >>> _

My current understanding is (A) that the interpreter is correct in this respect (for one would harldly want the effects of statements to be fundamentally different in interpreted mode, except the presentation of expression results), and (B), but here I'm less sure, that the documentation is incorrect.

So what I'm asking about is mainly (B), because if the documentation is correct after all, then there's something I haven't grokked. :-)


Cheers,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to