Re: Append a new value to dict

2008-10-23 Thread Frank Niemeyer
[EMAIL PROTECTED] schrieb: > Frank Niemeyer: >> There's simply no >> way to increment a non-existent value - not without performing some >> obscure implict behind-the-scenes stuff. > > Like importing and using a defaultdict(int). There's nothing implici

Re: Append a new value to dict

2008-10-22 Thread Frank Niemeyer
> However incrementing a non-existing key throws an exception. Right. And that's exactly what I would expect, according to the "principle of least surprise" Python tries to obey. There's simply no way to increment a non-existent value - not without performing some obscure implict behind-the-scenes