[Python-Dev] Proposal: defaultdict
"Martin v. Löwis"
martin at v.loewis.de
Sat Feb 18 00:52:51 CET 2006
Adam Olsen wrote:
> Consider these two pieces of code:
> if key in d:
> except KeyError:
> Before they were the same (assuming dosomething() won't raise
> KeyError). Now they would behave differently.
I personally think they should continue to do the same thing,
i.e. "in" should return True if there is a default; in the
current proposal, it should invoke the default factory.
But that's beside the point: Where is the real example
where this difference would matter? (I'm not asking for
a realistic example, I'm asking for a real one)
More information about the Python-Dev