Mr. Brewer:
I fruitlessly tried your "thing counter", as you can see below.
[color=blue][color=green][color=darkred]
>>> class AllThingsStartA tZero(dict):[/color][/color][/color]
.... def getitem (self, key):
.... return dict.get(self, key, 0)
....[color=blue][color=green][color=darkred]
>>> thingCounts = AllThingsStartA tZero()
>>> for thing in ('a','b','c','d ','a'):[/color][/color][/color]
.... thingCounts[thing] += 1
....
Traceback (most recent call last):
File "<interacti ve input>", line 2, in ?
KeyError: 'a'[color=blue][color=green][color=darkred]
>>> thingCounts[/color][/color][/color]
{}
Reason tells me it should work for me using...
PythonWin 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit
(Intel)] on win32.
....as it did for you. The runtime interpreter, however, says
otherwise. Can you see what I've done wrong...I can't?
With thanks in advance, I am,
Respectfully yours,
Fred Allen
I fruitlessly tried your "thing counter", as you can see below.
[color=blue][color=green][color=darkred]
>>> class AllThingsStartA tZero(dict):[/color][/color][/color]
.... def getitem (self, key):
.... return dict.get(self, key, 0)
....[color=blue][color=green][color=darkred]
>>> thingCounts = AllThingsStartA tZero()
>>> for thing in ('a','b','c','d ','a'):[/color][/color][/color]
.... thingCounts[thing] += 1
....
Traceback (most recent call last):
File "<interacti ve input>", line 2, in ?
KeyError: 'a'[color=blue][color=green][color=darkred]
>>> thingCounts[/color][/color][/color]
{}
Reason tells me it should work for me using...
PythonWin 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit
(Intel)] on win32.
....as it did for you. The runtime interpreter, however, says
otherwise. Can you see what I've done wrong...I can't?
With thanks in advance, I am,
Respectfully yours,
Fred Allen
Comment