kj <no.em...@please.post> writes: > But OrderedDict's functionality *requires* that its __init__ be > run, and this __init__, in turn, does part of its initialization > by calling the update method. > > Therefore, the update method of the new subclass needs to be able > to identify the calling function in order to make a special allowance > for calls coming from OrderedDict.__init__
That doesn't follow at all. Why not set a `frozen' flag when your initialization is complete? Something like class ImmutableOrderedDict (OrderedDict): def __init__(me, *args, **kw): me._frozen = False OrderedDict.__init__(me, *arg, **kw) me._frozen = True def _check(me): if me._frozen: raise ImmutableError And so on. Thank you for explaining your actual objective, by the way. -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list