overloading operators for a function object
Fletcher Johnson
flt.johnson at gmail.com
Sat Oct 1 00:50:42 EDT 2011
More information about the Python-list mailing list
Sat Oct 1 00:50:42 EDT 2011
- Next message (by thread): overloading operators for a function object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Is it possible to overload operators for a function?
For instance I would like to do something roughly like...
def func_maker():
def func(): pass
def __eq__(other):
if other == "check": return True
return False
func.__eq__ = __eq__
return func
newfunc = func_maker()
newfunc == "check" #true
newfunc == "no" #false
- Next message (by thread): overloading operators for a function object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list