On Feb 24, 1:31 pm, John Forse <johnfo...@talktalk.net> wrote: > I'm trying some examples from the language ref sections on the site in > the process of learning some python in 3.0.1. I've tried to run both > of the samples below ,but the only printout is "generator object chain > at 0x11f4dc8" whether I use print() or not .
Yes, because you're creating a generator object but you're not actually doing anything with it. > How do I use the sample > to produce the expected printout a b c d e f. Since you have a print inside 'chain', you should be able to get that output by doing the following: list(chain('abc','def')) Although I'd recommend removing the print from 'chain' and doing this instead: for elem in chain('abc','def'): print elem -- http://mail.python.org/mailman/listinfo/python-list