actually i ddin't think about the fact that you're overloading dict, which can already take multiple values in getitem
so how about class crazy: pass and then in your dict class: def __getitem__(*args): if args[-1] is crazy: return self.get(args[:-1])*5 else: return self.get(args) and then print foo[1,2] #not crazy print foo[1,2,crazy] #crazy I *think* that would work "Andreas Matthias" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The following code doesn't run but I hope you get what I > am trying to do. > > > class my_dict (dict): > > def __getitem__ (self, key, crazy = False): > if crazy == True: > return 5 * self.get(key) > else: > return self.get(key) > > > foo = my_dict() > foo['a'] = 123 > > print foo['a'] > print foo['a', crazy = True] > > > Is it somehow possible to overload __getitem__ with an additional > argument? Are there other possibilities to achiev this? Or is > the only solution to this to write a normal function call > `def my_get (self, key, crazy=False)'? > > > Ciao > Andreas -- http://mail.python.org/mailman/listinfo/python-list