On Thu, 29 Oct 2009 21:14:22 -0700, metal wrote: > Maybe my real goal is the following: > > def miter(iterable): > for x in tuple(iterable): > if x in iterable: > yield x
I don't think that does what you think it does. For some iterables it doesn't do anything at all: >>> it = iter([1,2,3]) >>> for item in miter(it): ... print item ... >>> and for others it is redundant: >>> it = [1,2,3] >>> for item in miter(it): # same as `for item in it:` ... print item ... 1 2 3 >>> Could you explain what you are trying to accomplish? -- Steven -- http://mail.python.org/mailman/listinfo/python-list