Have a look at the operator module:
import operator
get_truth(1.0, operator.gt, 0.0)
...
def get_truth(inp, relate, cut):
return relate(inp, cut)
# you don't actually need an if statement here
More Related Contents:
- Calling 2 functions from within a function
- How to pass dictionary items as function arguments in python? [duplicate]
- How to apply a function to each sublist of a list in python?
- Defining a default argument as a global variable
- Python function define: A message will prompt up if missing entering an argument
- How to remove English words from a file containing Dari words?
- How can I read inputs as numbers?
- IPython Notebook locale error [duplicate]
- Why is parenthesis in print voluntary in Python 2.7?
- How do I create a Python function with optional arguments?
- Implement MATLAB’s im2col ‘sliding’ in Python
- Accessing attributes on literals work on all types, but not `int`; why? [duplicate]
- Convert timedelta64[ns] column to seconds in Python Pandas DataFrame
- Inserting a table name into a query gives sqlite3.OperationalError: near “?”: syntax error
- Python 2.7 : Write to file instantly
- What is the difference between json.load() and json.loads() functions
- How to Run Python Code on SublimeREPL
- Pygame2Exe Errors that I can’t fix
- RegEx Get string between two strings that has line breaks
- Symbol not found: __PyCodecInfo_GetIncrementalDecoder
- Python decorator? – can someone please explain this? [duplicate]
- How to check whether optional function parameter is set
- class method generates “TypeError: … got multiple values for keyword argument …”
- Is there a function in python to split a word into a list? [duplicate]
- Why doesn’t an import in an exec in a function work?
- “unpacking” a passed dictionary into the function’s name space in Python?
- Python Pandas – Read csv file containing multiple tables
- Can’t install pygame on mac
- Run process with realtime output to a Tkinter GUI
- Google Search Web Scraping with Python