Hello,

You can pass an operator as an argument to your function.

See :
http://docs.python.org/library/operator.html

Regards,


---------- Forwarded message ----------
From: <mlangenho...@gmail.com>
Date: 2012/5/24
Subject: Dynamic comparison operators
To: python-list@python.org


I would like to pass something like this into a function
test(val1,val2,'>=')

and it should come back with True or False.

Is there a way to dynamically compare 2 values like this or will I have to
code each operator individually?
--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to