exec "x = 3; print x" in a - How does it work?

Ben Finney ben+python at benfinney.id.au
Wed Mar 9 00:50:40 EST 2016


"Veek. M" <vek.m1234 at gmail.com> writes:

> What is the return value of `exec`?

You can refer to the documentation for questions like that.
<URL:https://docs.python.org/3/library/functions.html#exec>

> Would that object be then used to iterate the sequence in 'a'?

The ‘for’ or ‘while’ statements are correct for iteration.

> I'm reading this:
> https://www.python.org/download/releases/2.2.3/descrintro/

Why?

-- 
 \          “Generally speaking, the errors in religion are dangerous; |
  `\    those in philosophy only ridiculous.” —David Hume, _A Treatise |
_o__)                                           of Human Nature_, 1739 |
Ben Finney




More information about the Python-list mailing list