Gurpreet Sachdeva wrote: > > Hi, > > Is there any provision in python which allows me to make my own operators? > > My problem is that I need to combine two dictonaries with their keys and > I don't want to use any of the existing operators like '+','-','*'. > So is there a way I can make '**' or '~' as my operators to add two > dictonaries? If not which all operators can I overoad?
Both ** and ~ are existing operators (although ~ is unary, not binary). You cannot make new ones, but you can overload all of the available ones for new classes (not old ones like dicts). http://docs.python.org/ref/numeric-types.html With a beautiful hack, you can make your own general, pseudo-operators. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122 -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list