generator construction

Jeremy Yallop jeremy at jdyallop.freeserve.co.uk
Wed Dec 4 11:11:06 EST 2002


* Eric van Riet Paap
| As an experiment I tried this list comprehension version:
| [yield node for node in Nodes(child)]
| 
| I understand that the list goes nowhere, but I thought it was a valid
| construction.
| Why do I get a "SyntaxError: invalid syntax" error?

For the same reason that the following would give an error:

  [return node for node in Nodes(child)]

Jeremy.



More information about the Python-list mailing list