Hello all,

Sadly I need to convert a great python application into C# .Net. I have been
pretty successful so far but I was wondering if anyone knew of something
similar to a python defaultdict(int) in C#. In python I am doing:

g = {} (where the value in the key value pair is a tuple of values)
f = defaultdict(int)

In order to get totals of particular values within each tuple within the
complete dictionary g I do:

for values in g.values():
   for item in values:
         f[item]+=1

I can accomplish this in C# by converting the values (which are stored as a
List) from a C# dictionary to  an Array then looping through the Array but
was wondering if anyone had a different take or thoughts how to do this in
C# as easily as it is done in Python.

Thanks.

G.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to