>>> class A(types.DictTyp e):
.... def __getitem__(sel f, key):
.... return types.DictType. __getitem__(sel f, key)
.... [color=blue][color=green][color=darkred]
>>> a = A()
>>> a[0] = 3
>>> a.__getitem__ = lambda x: "w00t"
>>> a.__getitem__(0 )[/color][/color][/color]
'w00t'[color=blue][color=green][color=darkred]
>>> a[/color][/color][/color]
{0: 3}[color=blue][color=green][color=darkred]
>>> a[0][/color][/color][/color]
3
Can anyone tell me why a[0] doesn't return "w00t", like I thought it
would? What method is a[0] calling? Is there a way to override it?
Robert Brewer
MIS
Amor Ministries
fumanchu@amor.o rg
.... def __getitem__(sel f, key):
.... return types.DictType. __getitem__(sel f, key)
.... [color=blue][color=green][color=darkred]
>>> a = A()
>>> a[0] = 3
>>> a.__getitem__ = lambda x: "w00t"
>>> a.__getitem__(0 )[/color][/color][/color]
'w00t'[color=blue][color=green][color=darkred]
>>> a[/color][/color][/color]
{0: 3}[color=blue][color=green][color=darkred]
>>> a[0][/color][/color][/color]
3
Can anyone tell me why a[0] doesn't return "w00t", like I thought it
would? What method is a[0] calling? Is there a way to override it?
Robert Brewer
MIS
Amor Ministries
fumanchu@amor.o rg
Comment