adding nested dictionaries in python from yield : If I do something like this:

    x1={'Count': 11, 'Name': 'Andrew'}
    x2={'Count': 14, 'Name': 'Matt'}
    x3={'Count': 17, 'Name': 'Devin'}
    x4={'Count': 20, 'Name': 'Andrew'}
    x1
    
    vars=[x1,x2,x3,x4]
    for i in vars:
        my_dict[i[group_by_column]]=i
    my_dict

Then I get:

    defaultdict(int,
                {'Andrew': {'Count': 20, 'Name': 'Andrew'},
                 'Devin': {'Count': 17, 'Name': 'Devin'},
                 'Geoff': {'Count': 10, 'Name': 'Geoff'},
                 'Matt': {'Count': 14, 'Name': 'Matt'}})

Which is exactly what I want.

However, when I try to replicate this from an object that is has a "yield" built into it, it keeps overwriting very value in the dictionary. For example, `cast_record_stream` is a function result that yields the following dictionaries as requested:

    {'Count': 11, 'Name': 'Andrew'}
    {'Count': 14, 'Name': 'Matt'}
    {'Count': 17, 'Name': 'Devin'}
    {'Count': 20, 'Name': 'Andrew'}
    {'Count': 5, 'Name': 'Geoff'}
    {'Count': 10, 'Name': 'Geoff'}

So then when I run this function it comes out wrong:

    for line in cast_record_stream:
        record_name=line['Name']
        my_dict[record_name]=line
    
        defaultdict(<type 'int'>, {'Devin': {'Count': 10, 'Name': 'Geoff'}, 
    'Matt': {'Count': 10, 'Name': 'Geoff'}, 
    'Geoff': {'Count': 10, 'Name': 'Geoff'}, 
    'Andrew': {'Count': 10, 'Name': 'Geoff'}})


Am I creating a problem here that I can't see? I figured it would just add one value at a time.