Andre Engels wrote:
To answer your question, we have to look at Python's data model, which
differs from that in other languages.
Strictly speaking, that is true: Python's data model is different from
that of (say) C, or Pascal, or Forth. But it's also the same as that in
other languages, lik
Knacktus wrote:
When I initialize the class which holds these dictionaries, though, I
need
to make sure that all the keys contained in d2 match the keys of d1.
Thus I
tried:
d1 = {'a': 0, 'b': 0, 'c': 0}
Now d1 holds the address of a dict in memory. [...]
Let me guess... did you learn C b
On Sun, May 1, 2011 at 5:49 AM, Ryan Strunk wrote:
> When I initialize the class which holds these dictionaries, though, I need
> to make sure that all the keys contained in d2 match the keys of d1. Thus I
> tried:
> d1 = {'a': 0, 'b': 0, 'c': 0}
> d2 = d1
> My understanding was that d2 looked at
def combine(d1, d2):
for key in d1:
if key in d2:
d2[key] += d1[key]
[Remark]
I usually avoid changing function arguments. But later on you're talking
about using this function as a method a class, so d1 and d2 would be
instance attributes I guess.
When I ini
Hello everyone,
I had an interesting thing come up earlier in my programming, and I'm trying
to wrap my mind around why it occurred.
I wanted to take two dictionaries with the same keys and combine their
values to make one, big super dictionary.
def combine(d1, d2):
for key in d1:
if