[XML-SIG] Deep copy of an element from one document to another

Fredrik Lundh fredrik@pythonware.com
Wed, 19 Jun 2002 17:52:54 +0200


uche wrote:

> Before I gave up, I considered a hack that would probably work,
> but was too ugly for contemplation:
>=20
> exec("yield")
>=20
> I decided against this  :-)

so did Guido:

>>> def bar():
...      yield 10
...
>>> bar()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 2, in bar
  File "<string>", line 1
SyntaxError: 'yield' outside function

(the compiler looks for a yield keyword when compiling the
function body.  if found, it creates an iterator factory, not
an ordinary function)

</F>