Message77047
James Stroud ran into this same issue with 2.5. Here is his 'ugly fix'
for working with protocol 2 only.
class DictPlus(dict):
def __init__(self, *args, **kwargs):
self.extra_thing = ExtraThingClass()
dict.__init__(self, *args, **kwargs)
def __setitem__(self, k, v):
try:
do_something_with(self.extra_thing, k, v)
except AttributeError:
self.extra_thing = ExtraThingClass()
do_something_with(self.extra_thing, k, v)
dict.__setitem__(self, k, v)
def __setstate__(self, adict):
pass
Can this be closed as "won't fix", since there seems nothing to fix?
This issue of working with all protocols would seem dead by now, and for
protocol 2, it is a 'gotcha' that can be avoided with knowledge. |
|
Date |
User |
Action |
Args |
2008-12-05 17:55:30 | terry.reedy | set | recipients:
+ terry.reedy, tim.peters, akuchling |
2008-12-05 17:55:30 | terry.reedy | set | messageid: <1228499730.65.0.607233400462.issue826897@psf.upfronthosting.co.za> |
2008-12-05 17:55:27 | terry.reedy | link | issue826897 messages |
2008-12-05 17:55:26 | terry.reedy | create | |
|