append - Dumb and Dummer

M. Clift noone at here.com
Mon Oct 4 14:03:49 EDT 2004


Hi Alex,

How do I print from this?

def weird_appender(sequence):
    first_time_choices = {'item1': 'abc', 'item2': 'def', }
    choices = { None: first_time_choices,
                'item1': {'item1': 'blu', 'item2': 'ghi', },
                'item2': {'item1': 'jkm', 'item2': 'nop', }
              }

    d = choices.get(previous, first_time_choices)
    choose = d.get(item, [''])
    yield item + random.choice(choose)
    previous = item

print ???


Thanks,

Malcolm





More information about the Python-list mailing list