Iterators & generators (RE: Real Problems with Python)

Samuel A. Falvo II kc5tja at
Mon Feb 14 03:02:55 CET 2000

In article <000001bf768e$48e40580$45a0143f at tim>, Tim Peters wrote:

>class BinTree:
>   # with members .left and .right of type BinTree (& None means none),
>   # and .data of an arbitrary type
>   ...
>   def traverse_post(self):
>       for child in self.left, self.right:
>           if child is not None:
>               suspend child.traverse_post()
>       suspend
>b = BinTree()
>for leaf in b.traverse_post():
>    process(leaf)

I'm sorry, but I can't follow this code at all.  What are the precise
semantics of suspend here?  How does it return?

KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA

More information about the Python-list mailing list