>>> class MyDict(dict): ... def __getitem__(self, item): ... if item == 'potato': ... return 'spud' ... return super().__getitem__(item) ... >>> def f(): ... pass ... ... >>> f.__dict__ = MyDict({'k': 'v'}) >>> f.k 'v' >>> f.potato AttributeError: 'function' object has no attribute 'potato'
00:00 - 19:0019:00 - 00:00
user6276743
user6276743
user6276743
user6276743
user6276743
00:00 - 19:0019:00 - 00:00